Build PHP 8.3.28RC1 #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build PHP | |
| run-name: Build PHP ${{ inputs.php-version }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| php-version: | |
| description: 'PHP version to build' | |
| required: true | |
| upload: | |
| type: choice | |
| options: ['true', 'false'] | |
| description: Upload artifacts to the downloads server | |
| required: false | |
| default: 'true' | |
| jobs: | |
| php: | |
| strategy: | |
| matrix: | |
| arch: [x64, x86] | |
| ts: [nts, ts] | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Build | |
| uses: ./php | |
| with: | |
| php-version: ${{ inputs.php-version }} | |
| arch: ${{ matrix.arch }} | |
| ts: ${{ matrix.ts }} | |
| artifacts: | |
| runs-on: ubuntu-latest | |
| needs: php | |
| outputs: | |
| artifact-id: ${{ steps.artifacts.outputs.artifact-id }} | |
| steps: | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact/merge@v5 | |
| id: artifacts | |
| with: | |
| name: artifacts | |
| delete-merged: true | |
| tests: | |
| strategy: | |
| matrix: | |
| arch: [x64, x86] | |
| ts: [nts, ts] | |
| opcache: [opcache, nocache] | |
| test-type: [php, ext] | |
| runs-on: windows-2022 | |
| needs: artifacts | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v5 | |
| id: artifacts | |
| with: | |
| name: artifacts | |
| - name: Get Cache Key | |
| id: cache-key | |
| run: | | |
| $pv = '${{inputs.php-version}}' | |
| if('${{inputs.php-version}}' -ne 'master') { | |
| $pv = '${{inputs.php-version}}'.Split('.')[0..1] -join '.' | |
| } | |
| $vsVersion = (Get-Content -Raw -Path (Join-Path $(pwd).Path '\php\BuildPhp\config\vs.json') | ConvertFrom-Json).php.$pv | |
| $packagesListUrl = "https://downloads.php.net/~windows/php-sdk/deps/series/packages-$pv-$vsVersion-${{ matrix.arch }}-staging.txt" | |
| Invoke-WebRequest -OutFile packages.txt -Uri $packagesListUrl | |
| Add-Content -Value "cache-key=deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT | |
| Add-Content -Value "cache-dir=C:\deps-$pv-${{ matrix.arch }}" -Path $env:GITHUB_OUTPUT | |
| - name: Cache Deps | |
| id: cache-deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.cache-key.outputs.cache-dir }} | |
| key: ${{ steps.cache-key.outputs.cache-key }}-${{ hashFiles('packages.txt') }} | |
| - name: Test PHP | |
| shell: pwsh | |
| continue-on-error: true | |
| env: | |
| DEPS_DIR: ${{ steps.cache-key.outputs.cache-dir }} | |
| DEPS_CACHE_HIT: ${{ steps.cache-deps.outputs.cache-hit }} | |
| run: | | |
| Import-Module (Join-Path $(pwd).Path '\php\BuildPhp') -Force | |
| Invoke-PhpTests -PhpVersion ${{inputs.php-version}} ` | |
| -Arch ${{matrix.arch}} ` | |
| -Ts ${{matrix.ts}} ` | |
| -Opcache ${{matrix.opcache}} ` | |
| -TestType ${{matrix.test-type}} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v5 | |
| continue-on-error: true | |
| with: | |
| name: test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}} | |
| path: test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}.xml | |
| upload: | |
| runs-on: ubuntu-latest | |
| needs: [artifacts, tests] | |
| if: ${{ github.event.inputs.upload == 'true' }} | |
| steps: | |
| - name: Upload to downloads server | |
| run: | | |
| url="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.artifacts.outputs.artifact-id }}/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 }} |