From 26596c91c2fa91f52d533aefac6710bd285be86a Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 30 Aug 2022 21:37:51 +0000 Subject: [PATCH] Add support for PHP 8.3 [skip ci] --- .github/workflows/php82.yml | 140 ++++++++++++++++++++++++++++++++ .github/workflows/phpmaster.yml | 4 +- scripts/Get-Php.ps1 | 2 + 3 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/php82.yml diff --git a/.github/workflows/php82.yml b/.github/workflows/php82.yml new file mode 100644 index 0000000..34ef95a --- /dev/null +++ b/.github/workflows/php82.yml @@ -0,0 +1,140 @@ +name: 'Build PHP 8.2' +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '30 23 * * *' +jobs: + build: + if: "!contains(github.event.head_commit.message, 'skip-8.2')" + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + include: + - arch: x64 + target: obj-x64 + config: nts-windows-vs16-x64 + - arch: x64 + target: obj-x64 + config: ts-windows-vs16-x64 + - arch: x64 + target: obj-x64 + config: nts-windows-vs16-x64-avx + - arch: x86 + target: obj + config: nts-windows-vs16-x86 + - arch: x86 + target: obj + config: ts-windows-vs16-x86 + name: Build PHP + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install PHP + uses: shivammathur/setup-php@develop + with: + php-version: 8.2 + ini-values: disable_functions=mail + - name: Test PHP + run: php -v + - name: Test php extensions + run: php -m + - name: Create Build Environment + run: | + New-Item -ItemType "directory" -Path C:\php-snap-build + cd C:\php-snap-build + git clone https://github.com/php/php-sdk-binary-tools.git php-sdk + git clone https://github.com/php/web-rmtools.git rmtools + New-Item -ItemType "directory" -Path C:\php-snap-build\${{ matrix.target }} + New-Item -ItemType "directory" -Path C:\php-snap-build\snap_82\vs16\${{ matrix.arch }} + Copy-Item -Path C:\php-snap-build\rmtools\bin\rmtools_setvars.bat-dist -Destination C:\php-snap-build\rmtools\bin\rmtools_setvars.bat + 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 + - name: Add InstantClient + run: | + $oci_dir="C:/php-snap-build/deps_aux/oracle/${{ matrix.arch }}" + New-Item -ItemType "directory" -Path $oci_dir + $suffix = 'windows' + if ('${{ matrix.arch }}' -eq 'x86') { + $suffix = 'nt' + } + Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $oci_dir\instantclient.zip + Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-sdk-$suffix.zip -OutFile $oci_dir\sdk.zip + Expand-Archive -Path $oci_dir\instantclient.zip -DestinationPath $oci_dir -Force + Expand-Archive -Path $oci_dir\sdk.zip -DestinationPath $oci_dir -Force + Get-ChildItem $oci_dir | ?{ $_.PSIsContainer } | Rename-Item -NewName instantclient_19_9 + - name: Patch Tools + run: | + $git_location="C:\Program Files\Git\cmd\git.exe" + $tar_location="C:\Program Files\Git\usr\bin\tar.exe" + $task_location="C:\php-snap-build\rmtools\bin\snapshot_task.bat" + $git_script_location="C:\php-snap-build\rmtools\include\Git.php" + $snap_script_location="C:\php-snap-build\rmtools\script\snap.php" + $branch_script_location="C:\php-snap-build\rmtools\include\Branch.php" + $config_location="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}\php82.ini" + ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location + ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location + ((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location + ((Get-Content -path $snap_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $snap_script_location + ((Get-Content -path $branch_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $branch_script_location + ((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location + - name: build PHP + run: | + C:\php-snap-build\php-sdk\bin\vswhere + $ErrorActionPreference = "Stop" + & 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 }}" + - name: Collect Artifacts + run: | + New-Item -ItemType "directory" -Path builds + Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds } + Copy-Item -Path C:\php-snap-build\rmtools\data\db\PHP-8.2.json -Destination .\builds\${{ matrix.config }}.json + if((Get-ChildItem .\builds\*.zip).Count -lt 5) { + exit 1 + } + $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]} + (Get-Content .\builds\${{ matrix.config }}.json | ConvertFrom-Json).revision_last > COMMIT + Get-ChildItem .\builds\* -Include ("php-$php_version*.zip", "php-master*.zip") | Foreach-Object { Compress-Archive -update COMMIT $_ } + Get-ChildItem .\builds\*.zip | Foreach-Object { + if ($_.Name -match '.*(rc|RC)\d*-dev.*') { + Copy-Item -Path $_ -Destination (Join-Path -Path builds -ChildPath ($_.Name -replace '(rc|RC)\d+', '')) -Force + } + } + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.config }} + path: builds + upload: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + - run: mkdir builds + - uses: actions/download-artifact@v2 + with: + path: builds + - name: Stage files + run: | + mkdir uploads + for file in ./builds/*/*; do + mv $file ./uploads/ + done + rm -rf uploads/*-src-*.zip || true + - name: Update release + run: | + set -x + assets=() + for asset in ./uploads/*; do + assets+=("$asset") + done + assets+=("./scripts/Get-PhpNightly.ps1") + assets+=("./scripts/Get-Php.ps1") + release='php8.2' + if ! gh release view "$release"; then + gh release create "$release" "${assets[@]}" -t "$release" -n "$release" + else + gh release upload "$release" "${assets[@]}" --clobber + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/phpmaster.yml b/.github/workflows/phpmaster.yml index 8a3e678..e902254 100644 --- a/.github/workflows/phpmaster.yml +++ b/.github/workflows/phpmaster.yml @@ -7,7 +7,7 @@ on: - cron: '30 23 * * *' jobs: build: - if: "!contains(github.event.head_commit.message, 'skip-8.2')" + if: "!contains(github.event.head_commit.message, 'skip-8.3')" runs-on: windows-2019 strategy: fail-fast: false @@ -133,7 +133,7 @@ jobs: done assets+=("./scripts/Get-PhpNightly.ps1") assets+=("./scripts/Get-Php.ps1") - for release in php8.2 master; do + for release in php8.3 master; do if ! gh release view "$release"; then gh release create "$release" "${assets[@]}" -t "$release" -n "$release" else diff --git a/scripts/Get-Php.ps1 b/scripts/Get-Php.ps1 index cb8d5bd..06bafcd 100644 --- a/scripts/Get-Php.ps1 +++ b/scripts/Get-Php.ps1 @@ -38,6 +38,8 @@ if($Version -eq '8.0') { $branch = 'PHP-8.0' } elseif($Version -eq '8.1') { $branch = 'PHP-8.1' +} elseif($Version -eq '8.2') { + $branch = 'PHP-8.2' } $semver = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/$branch/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]} Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$semver$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip