Skip to content

Commit 434620c

Browse files
committed
Add workflow to build 8.1 from the new branch
Fix master workflow to push builds to 8.2 branch
1 parent 445a3f0 commit 434620c

File tree

3 files changed

+142
-2
lines changed

3 files changed

+142
-2
lines changed

.github/workflows/php81.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: 'Build PHP 8.1'
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.1')"
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@v2
35+
- name: Install PHP
36+
uses: shivammathur/setup-php@develop
37+
with:
38+
php-version: 7.4
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/Microsoft/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_81\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_12_1
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_directory="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}"
76+
$config_location="$config_directory\php81.ini"
77+
Copy-Item "$config_directory\php80.ini" -Destination $config_location -Force
78+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location
79+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location
80+
((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location
81+
((Get-Content -path $snap_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $snap_script_location
82+
((Get-Content -path $branch_script_location -Raw) -replace "0, 7", "0, 10") | Set-Content -Path $branch_script_location
83+
((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location
84+
((Get-Content -path $config_location -Raw) -replace "8.0", "8.1") | Set-Content -Path $config_location
85+
- name: build PHP
86+
run: |
87+
C:\php-snap-build\php-sdk\bin\vswhere
88+
$ErrorActionPreference = "Stop"
89+
& C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "php81 ${{ matrix.config }}"
90+
- name: Collect Artifacts
91+
run: |
92+
New-Item -ItemType "directory" -Path builds
93+
Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
94+
Copy-Item -Path C:\php-snap-build\rmtools\data\db\PHP-8.1.json -Destination .\builds\${{ matrix.config }}.json
95+
if((Get-ChildItem .\builds\*.zip).Count -lt 5) {
96+
exit 1
97+
}
98+
$php_version = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/PHP-8.1/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
99+
(Get-Content .\builds\${{ matrix.config }}.json | ConvertFrom-Json).revision_last > COMMIT
100+
Get-ChildItem .\builds\* -Include ("php-$php_version*.zip", "php-master*.zip") | Foreach-Object { Compress-Archive -update COMMIT $_ }
101+
- name: Upload Artifact
102+
uses: actions/upload-artifact@v2
103+
with:
104+
name: ${{ matrix.config }}
105+
path: builds
106+
upload:
107+
runs-on: ubuntu-latest
108+
needs: build
109+
steps:
110+
- uses: actions/checkout@v2
111+
- run: mkdir builds
112+
- uses: actions/download-artifact@v2
113+
with:
114+
path: builds
115+
- name: Stage files
116+
run: |
117+
mkdir uploads
118+
for file in ./builds/*/*; do
119+
mv $file ./uploads/
120+
done
121+
rm -rf uploads/*-src-*.zip || true
122+
- name: Update release
123+
run: |
124+
set -x
125+
assets=()
126+
for asset in ./uploads/*; do
127+
assets+=("$asset")
128+
done
129+
assets+=("./scripts/Get-PhpNightly.ps1")
130+
assets+=("./scripts/Get-Php.ps1")
131+
release='php8.1'
132+
if ! gh release view "$release"; then
133+
gh release create "$release" "${assets[@]}" -t "$release" -n "$release"
134+
else
135+
gh release upload "$release" "${assets[@]}" --clobber
136+
fi
137+
env:
138+
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.1')"
10+
if: "!contains(github.event.head_commit.message, 'skip-8.2')"
1111
runs-on: windows-2019
1212
strategy:
1313
fail-fast: false
@@ -133,7 +133,7 @@ jobs:
133133
done
134134
assets+=("./scripts/Get-PhpNightly.ps1")
135135
assets+=("./scripts/Get-Php.ps1")
136-
for release in php8.1 master; do
136+
for release in php8.2 master; do
137137
if ! gh release view "$release"; then
138138
gh release create "$release" "${assets[@]}" -t "$release" -n "$release"
139139
else

scripts/Get-Php.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ if($ThreadSafe) {
3636
$branch = 'master'
3737
if($Version -eq '8.0') {
3838
$branch = 'PHP-8.0'
39+
} elseif($Version -eq '8.0') {
40+
$branch = 'PHP-8.1'
3941
}
4042
$semver = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/$branch/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
4143
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

0 commit comments

Comments
 (0)