|
| 1 | +name: 'Build PHP 8.2' |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | + schedule: |
| 7 | + - cron: '30 23 * * *' |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + if: "!contains(github.event.head_commit.message, 'skip-8.2')" |
| 11 | + runs-on: windows-2019 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - arch: x64 |
| 17 | + target: obj-x64 |
| 18 | + config: nts-windows-vs16-x64 |
| 19 | + - arch: x64 |
| 20 | + target: obj-x64 |
| 21 | + config: ts-windows-vs16-x64 |
| 22 | + - arch: x64 |
| 23 | + target: obj-x64 |
| 24 | + config: nts-windows-vs16-x64-avx |
| 25 | + - arch: x86 |
| 26 | + target: obj |
| 27 | + config: nts-windows-vs16-x86 |
| 28 | + - arch: x86 |
| 29 | + target: obj |
| 30 | + config: ts-windows-vs16-x86 |
| 31 | + name: Build PHP |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v3 |
| 35 | + - name: Install PHP |
| 36 | + uses: shivammathur/setup-php@develop |
| 37 | + with: |
| 38 | + php-version: 8.2 |
| 39 | + ini-values: disable_functions=mail |
| 40 | + - name: Test PHP |
| 41 | + run: php -v |
| 42 | + - name: Test php extensions |
| 43 | + run: php -m |
| 44 | + - name: Create Build Environment |
| 45 | + run: | |
| 46 | + New-Item -ItemType "directory" -Path C:\php-snap-build |
| 47 | + cd C:\php-snap-build |
| 48 | + git clone https://github.com/php/php-sdk-binary-tools.git php-sdk |
| 49 | + git clone https://github.com/php/web-rmtools.git rmtools |
| 50 | + New-Item -ItemType "directory" -Path C:\php-snap-build\${{ matrix.target }} |
| 51 | + New-Item -ItemType "directory" -Path C:\php-snap-build\snap_82\vs16\${{ matrix.arch }} |
| 52 | + Copy-Item -Path C:\php-snap-build\rmtools\bin\rmtools_setvars.bat-dist -Destination C:\php-snap-build\rmtools\bin\rmtools_setvars.bat |
| 53 | + Copy-Item -Path C:\php-snap-build\rmtools\data\config\credentials_ftps.php-dist -Destination C:\php-snap-build\rmtools\data\config\credentials_ftps.php |
| 54 | + - name: Add InstantClient |
| 55 | + run: | |
| 56 | + $oci_dir="C:/php-snap-build/deps_aux/oracle/${{ matrix.arch }}" |
| 57 | + New-Item -ItemType "directory" -Path $oci_dir |
| 58 | + $suffix = 'windows' |
| 59 | + if ('${{ matrix.arch }}' -eq 'x86') { |
| 60 | + $suffix = 'nt' |
| 61 | + } |
| 62 | + Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $oci_dir\instantclient.zip |
| 63 | + Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-sdk-$suffix.zip -OutFile $oci_dir\sdk.zip |
| 64 | + Expand-Archive -Path $oci_dir\instantclient.zip -DestinationPath $oci_dir -Force |
| 65 | + Expand-Archive -Path $oci_dir\sdk.zip -DestinationPath $oci_dir -Force |
| 66 | + Get-ChildItem $oci_dir | ?{ $_.PSIsContainer } | Rename-Item -NewName instantclient_19_9 |
| 67 | + - name: Patch Tools |
| 68 | + run: | |
| 69 | + $git_location="C:\Program Files\Git\cmd\git.exe" |
| 70 | + $tar_location="C:\Program Files\Git\usr\bin\tar.exe" |
| 71 | + $task_location="C:\php-snap-build\rmtools\bin\snapshot_task.bat" |
| 72 | + $git_script_location="C:\php-snap-build\rmtools\include\Git.php" |
| 73 | + $snap_script_location="C:\php-snap-build\rmtools\script\snap.php" |
| 74 | + $branch_script_location="C:\php-snap-build\rmtools\include\Branch.php" |
| 75 | + $config_location="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}\php82.ini" |
| 76 | + ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location |
| 77 | + ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location |
| 78 | + ((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location |
| 79 | + ((Get-Content -path $snap_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $snap_script_location |
| 80 | + ((Get-Content -path $branch_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $branch_script_location |
| 81 | + ((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location |
| 82 | + - name: build PHP |
| 83 | + run: | |
| 84 | + C:\php-snap-build\php-sdk\bin\vswhere |
| 85 | + $ErrorActionPreference = "Stop" |
| 86 | + & C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "php82 ${{ matrix.config }}" |
| 87 | + - name: Collect Artifacts |
| 88 | + run: | |
| 89 | + New-Item -ItemType "directory" -Path builds |
| 90 | + Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds } |
| 91 | + Copy-Item -Path C:\php-snap-build\rmtools\data\db\PHP-8.2.json -Destination .\builds\${{ matrix.config }}.json |
| 92 | + if((Get-ChildItem .\builds\*.zip).Count -lt 5) { |
| 93 | + exit 1 |
| 94 | + } |
| 95 | + $php_version = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/PHP-8.2/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]} |
| 96 | + (Get-Content .\builds\${{ matrix.config }}.json | ConvertFrom-Json).revision_last > COMMIT |
| 97 | + Get-ChildItem .\builds\* -Include ("php-$php_version*.zip", "php-master*.zip") | Foreach-Object { Compress-Archive -update COMMIT $_ } |
| 98 | + Get-ChildItem .\builds\*.zip | Foreach-Object { |
| 99 | + if ($_.Name -match '.*(rc|RC)\d*-dev.*') { |
| 100 | + Copy-Item -Path $_ -Destination (Join-Path -Path builds -ChildPath ($_.Name -replace '(rc|RC)\d+', '')) -Force |
| 101 | + } |
| 102 | + } |
| 103 | + - name: Upload Artifact |
| 104 | + uses: actions/upload-artifact@v2 |
| 105 | + with: |
| 106 | + name: ${{ matrix.config }} |
| 107 | + path: builds |
| 108 | + upload: |
| 109 | + runs-on: ubuntu-latest |
| 110 | + needs: build |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v3 |
| 113 | + - run: mkdir builds |
| 114 | + - uses: actions/download-artifact@v2 |
| 115 | + with: |
| 116 | + path: builds |
| 117 | + - name: Stage files |
| 118 | + run: | |
| 119 | + mkdir uploads |
| 120 | + for file in ./builds/*/*; do |
| 121 | + mv $file ./uploads/ |
| 122 | + done |
| 123 | + rm -rf uploads/*-src-*.zip || true |
| 124 | + - name: Update release |
| 125 | + run: | |
| 126 | + set -x |
| 127 | + assets=() |
| 128 | + for asset in ./uploads/*; do |
| 129 | + assets+=("$asset") |
| 130 | + done |
| 131 | + assets+=("./scripts/Get-PhpNightly.ps1") |
| 132 | + assets+=("./scripts/Get-Php.ps1") |
| 133 | + release='php8.2' |
| 134 | + if ! gh release view "$release"; then |
| 135 | + gh release create "$release" "${assets[@]}" -t "$release" -n "$release" |
| 136 | + else |
| 137 | + gh release upload "$release" "${assets[@]}" --clobber |
| 138 | + fi |
| 139 | + env: |
| 140 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments