Skip to content

Commit a900a3b

Browse files
committed
Fix PHP 8.3 and master builds
1 parent f0154d9 commit a900a3b

File tree

2 files changed

+146
-2
lines changed

2 files changed

+146
-2
lines changed

.github/workflows/php83.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: 'Build PHP 8.3'
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.3')"
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.3
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_83\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 }}\php83.ini"
76+
77+
# Patch to add PHP 8.3 config
78+
$config_dir="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}"
79+
Copy-Item -Path $config_dir\php82.ini -Destination $config_location
80+
((Get-Content -path $config_location -Raw) -replace "8.2", "8.3") | Set-Content -Path $config_location
81+
82+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location
83+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location
84+
((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location
85+
((Get-Content -path $snap_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $snap_script_location
86+
((Get-Content -path $branch_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $branch_script_location
87+
((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location
88+
- name: build PHP
89+
run: |
90+
C:\php-snap-build\php-sdk\bin\vswhere
91+
$ErrorActionPreference = "Stop"
92+
& C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "php83 ${{ matrix.config }}"
93+
- name: Collect Artifacts
94+
run: |
95+
New-Item -ItemType "directory" -Path builds
96+
Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
97+
Copy-Item -Path C:\php-snap-build\rmtools\data\db\PHP-8.3.json -Destination .\builds\${{ matrix.config }}.json
98+
if((Get-ChildItem .\builds\*.zip).Count -lt 5) {
99+
exit 1
100+
}
101+
$php_version = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/PHP-8.3/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
102+
(Get-Content .\builds\${{ matrix.config }}.json | ConvertFrom-Json).revision_last > COMMIT
103+
Get-ChildItem .\builds\* -Include ("php-$php_version*.zip", "php-master*.zip") | Foreach-Object { Compress-Archive -update COMMIT $_ }
104+
Get-ChildItem .\builds\*.zip | Foreach-Object {
105+
if ($_.Name -match '.*(rc|RC)\d*-dev.*') {
106+
Copy-Item -Path $_ -Destination (Join-Path -Path builds -ChildPath ($_.Name -replace '(rc|RC)\d+', '')) -Force
107+
}
108+
}
109+
- name: Upload Artifact
110+
uses: actions/upload-artifact@v2
111+
with:
112+
name: ${{ matrix.config }}
113+
path: builds
114+
upload:
115+
runs-on: ubuntu-latest
116+
needs: build
117+
steps:
118+
- name: Checkout
119+
uses: actions/checkout@v3
120+
121+
- name: Create builds directory
122+
run: mkdir builds
123+
124+
- name: Download artifacts
125+
uses: actions/download-artifact@v3
126+
with:
127+
path: builds
128+
129+
- name: Setup Python
130+
uses: actions/setup-python@v4
131+
with:
132+
python-version: 3.x
133+
134+
- name: Install cloudsmith-cli
135+
run: pip install --upgrade cloudsmith-cli
136+
137+
- name: Release
138+
run: bash scripts/release.sh
139+
env:
140+
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
141+
GITHUB_MESSAGE: ${{ github.event.head_commit.message }}
142+
GITHUB_RELEASES: php8.3
143+
GITHUB_REPOSITORY: ${{ github.repository }}
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/phpmaster.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- cron: '30 23 * * *'
88
jobs:
99
build:
10-
if: "!contains(github.event.head_commit.message, 'skip-8.3')"
10+
if: "!contains(github.event.head_commit.message, 'skip-8.4')"
1111
runs-on: windows-2019
1212
strategy:
1313
fail-fast: false
@@ -136,6 +136,6 @@ jobs:
136136
env:
137137
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
138138
GITHUB_MESSAGE: ${{ github.event.head_commit.message }}
139-
GITHUB_RELEASES: php8.3 master
139+
GITHUB_RELEASES: php8.4 master
140140
GITHUB_REPOSITORY: ${{ github.repository }}
141141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)