diff --git a/.github/workflows/pecl.yml b/.github/workflows/pecl.yml index 88dfcdb..de04e92 100644 --- a/.github/workflows/pecl.yml +++ b/.github/workflows/pecl.yml @@ -119,3 +119,14 @@ jobs: else gh release upload pecl $extension-${{ inputs.extension-ref }}.zip -R ${{ github.repository }} --clobber fi + upload: + runs-on: ubuntu-latest + needs: pecl-release + steps: + - name: Upload to downloads server + run: | + extension=$(basename "${{ inputs.extension-url }}") + url="https://github.com/$%7B%7B%20github.repository%20%7D%7D/releases/download/pecl/$extension-$%7B%7B%20inputs.extension-ref%20%7D%7D.zip" + gh workflow run pecl.yml -R php/web-downloads -f url="$url" -f extension="$extension" -f ref="${{ inputs.extension-ref }}" + env: + GITHUB_TOKEN: ${{ secrets.WINDOWS_BUILDS_TOKEN }} diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6062bb4..96d9c17 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -6,6 +6,7 @@ on: php-version: description: 'PHP version to build' required: true + jobs: php: strategy: @@ -27,9 +28,22 @@ jobs: artifacts: runs-on: ubuntu-latest needs: php + outputs: + artifact-id: ${{ steps.artifacts.outputs.artifact-id }} steps: - name: Upload artifacts uses: actions/upload-artifact/merge@v4 + id: artifacts with: name: artifacts - delete-merged: true \ No newline at end of file + delete-merged: true + upload: + runs-on: ubuntu-latest + needs: artifacts + steps: + - name: Upload to downloads server + run: | + url="https://api.github.com/repos/$%7B%7B%20github.repository%20%7D%7D/actions/artifacts/$%7B%7B%20needs.artifacts.outputs.artifact-id%20%7D%7D/zip" + gh workflow run php.yml -R php/web-downloads -f url="$url" -f php-version=${{ inputs.php-version }} + env: + GITHUB_TOKEN: ${{ secrets.WINDOWS_BUILDS_TOKEN }} diff --git a/README.md b/README.md index 275b1fb..1983d41 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Build a PHP extension for a specific version. - `run-tests` (optional) - Run the extension tests. Defaults to `true`. - `test-runner` (optional) - The test runner to use. Defaults to `run-tests.php`. - `test-opcache-mode` (optional) - Run tests with opcache `on`, `off` or `both`. Defaults to `off`. +- `test-workers` (optional) - The number of workers to use when running tests. Defaults to `8`. - `auth-token` (optional) - Authentication token to use in case the extension is hosted on a private repository. Instead of having to configure all the inputs for the extension action, you can use the `extension-matrix` action to get the matrix of jobs with different input configurations. diff --git a/extension/BuildPhpExtension/patches/grpc.ps1 b/extension/BuildPhpExtension/patches/grpc.ps1 index c19b75f..d22ca79 100644 --- a/extension/BuildPhpExtension/patches/grpc.ps1 +++ b/extension/BuildPhpExtension/patches/grpc.ps1 @@ -10,5 +10,5 @@ function CreateFolderIfMissing(path) { "@ (Get-Content config.w32) | ForEach-Object { $_.Replace('base_dir+"\\ext\\grpc', 'base_dir+"') } | Set-Content config.w32 (Get-Content config.w32) | ForEach-Object { $_.Replace('FSO.CreateFolder', 'CreateFolderIfMissing') } | Set-Content config.w32 -(Get-Content config.w32) | ForEach-Object { $_ -replace '/D_WIN32_WINNT=0x600', '/D_WIN32_WINNT=0x600 /FS /std:c11' } | Set-Content config.w32 +(Get-Content config.w32) | ForEach-Object { $_ -replace '/D_WIN32_WINNT=0x600', '/D_WIN32_WINNT=0x600 /FS /std:c++17' } | Set-Content config.w32 (Get-Content config.w32) | ForEach-Object { $_.Replace('ARG_WITH("grpc", "grpc support", "no");', $fn) } | Set-Content config.w32 diff --git a/extension/BuildPhpExtension/patches/imagick.ps1 b/extension/BuildPhpExtension/patches/imagick.ps1 new file mode 100644 index 0000000..9fd1366 --- /dev/null +++ b/extension/BuildPhpExtension/patches/imagick.ps1 @@ -0,0 +1 @@ +(Get-Content imagick.c) | ForEach-Object { $_ -replace 'php_strtolower', 'zend_str_tolower' } | Set-Content imagick.c \ No newline at end of file diff --git a/extension/BuildPhpExtension/private/Add-Package.ps1 b/extension/BuildPhpExtension/private/Add-Package.ps1 index ff71643..b950cf0 100644 --- a/extension/BuildPhpExtension/private/Add-Package.ps1 +++ b/extension/BuildPhpExtension/private/Add-Package.ps1 @@ -59,7 +59,7 @@ function Add-Package { } } Get-ChildItem -Path ..\deps\bin -Recurse -Include "*.pdb" | ForEach-Object { - if(Test-Path "artifacts\$($_.Name.Split('.')[0]).dll") { + if(Test-Path "artifacts\$($_.Name.Replace('.pdb', '.dll'))") { Copy-Item -Path $_.FullName -Destination artifacts -Force } } diff --git a/extension/BuildPhpExtension/private/Get-ExtensionConfig.ps1 b/extension/BuildPhpExtension/private/Get-ExtensionConfig.ps1 index 4810ced..73aea14 100644 --- a/extension/BuildPhpExtension/private/Get-ExtensionConfig.ps1 +++ b/extension/BuildPhpExtension/private/Get-ExtensionConfig.ps1 @@ -67,6 +67,9 @@ Function Get-ExtensionConfig { if($Extension.Contains("oci8")) { $packageName = "oci8" } + if($Extension.Contains("ddtrace")) { + $packageName = "datadog_trace" + } $config = [PSCustomObject]@{ name = $Extension package_name = $packageName diff --git a/extension/BuildPhpExtension/private/Get-LibrariesFromConfig.ps1 b/extension/BuildPhpExtension/private/Get-LibrariesFromConfig.ps1 index ac2c9e1..c3f5137 100644 --- a/extension/BuildPhpExtension/private/Get-LibrariesFromConfig.ps1 +++ b/extension/BuildPhpExtension/private/Get-LibrariesFromConfig.ps1 @@ -71,7 +71,7 @@ Function Get-LibrariesFromConfig { $foundItems = @() $libraryFilesFound = @() - [regex]::Matches($ConfigW32Content, 'CHECK_LIB\(["'']([^"'']+)["'']|["'']([^"'']+.lib)["'']|(\w+\.lib)') | ForEach-Object { + [regex]::Matches($ConfigW32Content, 'CHECK_LIB\(["'']([^"'']+)["'']|["'']([^"'']+\.lib)["'']|(\w+\.lib)') | ForEach-Object { $_.Groups[1].Value.Split(';') + ($_.Groups[2].Value -Split '[^\w\.]') + ($_.Groups[3].Value -Split '[^\w\.]') | ForEach-Object { $libraryFilesFound += $_ } diff --git a/extension/BuildPhpExtension/private/Invoke-CleanupTempFIles.ps1 b/extension/BuildPhpExtension/private/Invoke-CleanupTempFIles.ps1 index 659e1d0..1b67512 100644 --- a/extension/BuildPhpExtension/private/Invoke-CleanupTempFIles.ps1 +++ b/extension/BuildPhpExtension/private/Invoke-CleanupTempFIles.ps1 @@ -4,12 +4,16 @@ Function Invoke-CleanupTempFiles { $newSystemFiles = Compare-Object -ReferenceObject $script:initialSystemState -DifferenceObject $currentSystemState -Property FullName | Where-Object {$_.SideIndicator -eq "=>"} $newUserFiles = Compare-Object -ReferenceObject $script:initialUserState -DifferenceObject $currentUserState -Property FullName | Where-Object {$_.SideIndicator -eq "=>"} - $tempFiles = $newSystemFiles + $newUserFiles + $tempFiles = @($newSystemFiles) + @($newUserFiles) if($tempFiles.Count -gt 0) { Write-Host "Cleaning up temporary files" $tempFiles | ForEach-Object { Write-Host "Removing $($_.FullName)" - Remove-Item -Path $_.FullName -Force + try { + Remove-Item -Path $_.FullName -Force + } catch { + Write-Host "Failed to remove $($_.FullName)" + } } } } diff --git a/extension/BuildPhpExtension/private/Invoke-Tests.ps1 b/extension/BuildPhpExtension/private/Invoke-Tests.ps1 index bcb7ea3..62f2606 100644 --- a/extension/BuildPhpExtension/private/Invoke-Tests.ps1 +++ b/extension/BuildPhpExtension/private/Invoke-Tests.ps1 @@ -40,7 +40,6 @@ Function Invoke-Tests { throw "Test runner $env:TEST_RUNNER does not exist." } $test_runner_args = @( - '-j8', '-q', '--offline', '--show-diff', @@ -48,6 +47,13 @@ Function Invoke-Tests { '--set-timeout 120', '-g FAIL,XFAIL,BORK,WARN,LEAK,SKIP' ) + $test_workers = 8 + if($null -ne $env:TEST_WORKERS -and $env:TEST_WORKERS -ne '') { + $test_workers = $env:TEST_WORKERS + } + if($Config.php_version -ge '7.4') { + $test_runner_args += ('-j' + $test_workers) + } $opcacheModes = @($env:TEST_OPCACHE_MODE) if($env:TEST_OPCACHE_MODE -eq 'both') { diff --git a/extension/action.yml b/extension/action.yml index 7f916eb..8513b01 100644 --- a/extension/action.yml +++ b/extension/action.yml @@ -43,6 +43,10 @@ inputs: description: Test opcache mode required: false default: 'off' + test-workers: + description: Test workers + required: false + default: '8' build-directory: description: Directory to build the extension in required: false @@ -64,6 +68,7 @@ runs: RUN_TESTS: ${{inputs.run-tests}} TEST_RUNNER: ${{inputs.test-runner}} TEST_OPCACHE_MODE: ${{inputs.test-opcache-mode}} + TEST_WORKERS: ${{inputs.test-workers}} BUILD_DIRECTORY: ${{inputs.build-directory}} AUTH_TOKEN: ${{inputs.auth-token}} AUTO_DETECT_ARGS: ${{env.auto-detect-args}}