Skip to content

Commit 314dec8

Browse files
committed
Add support for PHP 8.1
1 parent d59d4b8 commit 314dec8

File tree

2 files changed

+137
-5
lines changed

2 files changed

+137
-5
lines changed

.github/workflows/php80.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: 'Build PHP 8.0'
2+
on:
3+
push:
4+
pull_request:
5+
repository_dispatch:
6+
schedule:
7+
- cron: '30 23 * * *'
8+
jobs:
9+
build:
10+
if: "!contains(github.event.head_commit.message, 'skip-build')"
11+
runs-on: windows-latest
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_80\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+
$config_location="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}\php80.ini"
74+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location
75+
((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location
76+
((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location
77+
((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location
78+
- name: build PHP
79+
run: |
80+
& C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "php80 ${{ matrix.config }}"
81+
- name: Collect Artifacts
82+
run: |
83+
New-Item -ItemType "directory" -Path builds
84+
Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
85+
Copy-Item -Path C:\php-snap-build\rmtools\data\db\PHP-8.0.json -Destination .\builds\${{ matrix.config }}.json
86+
- name: Upload Artifact
87+
uses: actions/upload-artifact@v2
88+
with:
89+
name: ${{ matrix.config }}
90+
path: builds
91+
upload:
92+
runs-on: ubuntu-latest
93+
needs: build
94+
steps:
95+
- uses: actions/checkout@v2
96+
- run: mkdir builds
97+
- uses: actions/download-artifact@v2
98+
with:
99+
path: builds
100+
- name: Upload to bintray
101+
env:
102+
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
103+
BINTRAY_USER: shivammathur
104+
BINTRAY_REPO: php
105+
GITHUB_REPOSITORY: ${{ github.repository }}
106+
run: |
107+
VERSION='8.0'
108+
curl \
109+
--user "$BINTRAY_USER":"$BINTRAY_KEY" \
110+
--header "Content-Type: application/json" \
111+
--data " \
112+
{\"name\": \"$VERSION-windows\", \
113+
\"vcs_url\": \"$GITHUB_REPOSITORY\", \
114+
\"licenses\": [\"MIT\"], \
115+
\"public_download_numbers\": true, \
116+
\"public_stats\": true \
117+
}" \
118+
https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
119+
mkdir uploads
120+
for file in ./builds/*/*; do
121+
mv $file ./uploads/
122+
done
123+
cd uploads || exit
124+
rm -rf *-src-*.zip || true
125+
for file in ./*; do
126+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
127+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
128+
done
129+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true

.github/workflows/build.yml renamed to .github/workflows/phpmaster.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Build PHP'
1+
name: 'Build PHP master'
22
on:
33
push:
44
pull_request:
@@ -80,16 +80,18 @@ jobs:
8080
& C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "phpmaster ${{ matrix.config }}"
8181
- name: Collect Artifacts
8282
run: |
83+
$php_version = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/master/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
8384
New-Item -ItemType "directory" -Path builds
8485
Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
86+
Copy-Item -Path builds -Destination master -Container -Recurse
8587
Copy-Item -Path C:\php-snap-build\rmtools\data\db\master.json -Destination .\builds\${{ matrix.config }}.json
86-
$php_version = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/master/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
87-
Get-ChildItem .\builds *.zip | Rename-Item -NewName { $_.name -replace "win32","windows" }
88+
Get-ChildItem .\master *.zip | Rename-Item -NewName { $_.name -replace "win32","windows" }
8889
if(("${{ matrix.config }}" -eq "ts-windows-vs16-x64") -or ("${{ matrix.config }}" -eq "ts-windows-vs16-x86")) {
89-
Get-ChildItem .\builds *.zip | Rename-Item -NewName { $_.name -replace $php_version,"master-ts" }
90+
Get-ChildItem .\master *.zip | Rename-Item -NewName { $_.name -replace $php_version,"master-ts" }
9091
} else {
91-
Get-ChildItem .\builds *.zip | Rename-Item -NewName { $_.name -replace $php_version,"master" }
92+
Get-ChildItem .\master *.zip | Rename-Item -NewName { $_.name -replace $php_version,"master" }
9293
}
94+
Get-ChildItem .\master\* -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
9395
- name: Upload Artifact
9496
uses: actions/upload-artifact@v2
9597
with:
@@ -128,6 +130,7 @@ jobs:
128130
mv $file ./uploads/
129131
done
130132
cd uploads || exit
133+
rm -rf *-src-*.zip || true
131134
for file in ./*; do
132135
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
133136
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true

0 commit comments

Comments
 (0)