-
Notifications
You must be signed in to change notification settings - Fork 29
221 lines (202 loc) · 8.4 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: windows test
on:
workflow_dispatch:
inputs:
libraries:
description: "libraries"
required: false
default: "zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2"
extensions:
description: "extensions"
required: false
default: "dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd"
lib_only:
description: "build libraries only"
required: false
default: ""
push:
schedule:
- cron: "33 4 * * *"
env:
LWMBS_LIBRARIES: zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2
LWMBS_EXTENSIONS: dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd
jobs:
build:
name: PHP ${{ matrix.php-version }} ${{ matrix.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- php-version: "8.2"
arch: "x64"
- php-version: "8.1"
arch: "x64"
- php-version: "8.0"
arch: "x64"
- php-version: "8.2"
arch: "arm64"
max-parallel: 4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Calc sources hash
id: src_hash
shell: pwsh
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
Write-Output "hash=" | Out-File "${env:GITHUB_OUTPUT}" -Append -NoNewline
php fetch_source.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" `
--phpVer=${{ matrix.php-version }} `
--hash | Out-File "${env:GITHUB_OUTPUT}" -Append -NoNewline
Write-Host ""
- name: Cache libraries
uses: actions/cache@v3
id: cache
with:
path: |
build/src
build/downloads
build/deps
key: windows-v2-${{ matrix.arch }}-${{ steps.src_hash.outputs.hash }}
- name: Prepare tools and sources
id: prepare
shell: pwsh
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
New-Item -ItemType Container -Force C:\tools\php-sdk-binary-tools
New-Item -ItemType Container -Force build
Set-Location build
# prepare nasm
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip" `
-OutFile "nasm-2.15.05-win64.zip"
unzip nasm-2.15.05-win64.zip
if (0 -Ne $lastexitcode) {
exit 1
}
Move-Item nasm-2.15.05/*.exe C:\Windows\system32
Move-Item nasm-2.15.05/rdoff/*.exe C:\Windows\system32
# prepare binary sdk
git clone --depth 1 --single-branch --branch master https://github.com/php/php-sdk-binary-tools C:\tools\php-sdk-binary-tools
if (0 -Ne $lastexitcode) {
exit 1
}
# fetch source
php ${env:GITHUB_WORKSPACE}/fetch_source.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" `
--phpVer=${{ matrix.php-version }} `
--shallowClone
if (0 -Ne $lastexitcode) {
exit 1
}
php ${env:GITHUB_WORKSPACE}/dump_licenses.php `
${env:GITHUB_WORKSPACE}\licenses
if (0 -Ne $lastexitcode) {
exit 1
}
# TODO: filters
# if ("${{ matrix.arch }}" -Eq "arm64") {
# # https://github.com/openssl/openssl/issues/20234
# Invoke-WebRequest -Uri https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20244.patch `
# -OutFile "win-openssl-aa64.patch"
# Push-Location src\openssl
# Get-Content ..\..\win-openssl-aa64.patch | & patch -p1
# if (0 -Ne $lastexitcode) {
# exit 1
# }
# Pop-Location
# }
- name: Prepare libraries
if: steps.cache.outputs.cache-hit != 'true'
working-directory: build
shell: pwsh
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
php ${env:GITHUB_WORKSPACE}/build_libs.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools `
--vsVer=17 `
--arch=${{ matrix.arch }}
- name: Build micro
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro
shell: pwsh
working-directory: build
continue-on-error: true
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
php ${env:GITHUB_WORKSPACE}/build_micro.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" `
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools `
--vsVer=17 `
--arch=${{ matrix.arch }}
cp src/php-src/${{ matrix.arch }}/Release_TS/micro.sfx ..
- name: Upload artifact for micro
if: steps.micro.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
licenses
micro.sfx
- name: Build micro-cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro-cli
shell: pwsh
working-directory: build
continue-on-error: true
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
rm -Force src/php-src/${{ matrix.arch }}/Release_TS/sapi/micro/php_micro.obj
php ${env:GITHUB_WORKSPACE}/build_micro.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" `
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools `
--vsVer=17 `
--arch=${{ matrix.arch }} `
--fakeCli
cp src/php-src/${{ matrix.arch }}/Release_TS/micro.sfx ../micro-cli.sfx
- name: Upload artifact for micro-cli
if: steps.micro-cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro-cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
licenses
micro-cli.sfx
- name: Build cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: cli
shell: pwsh
working-directory: build
continue-on-error: true
run: |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}"
php ${env:GITHUB_WORKSPACE}/build_cli.php `
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" `
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" `
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools `
--vsVer=17 `
--arch=${{ matrix.arch }}
cp src/php-src/${{ matrix.arch }}/Release_TS/php.exe ..
- name: Upload artifact for cli
if: steps.cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
licenses
php.exe
- name: Fail if anything failed
if: steps.micro.outcome == 'failure' || steps.micro-cli.outcome == 'failure' || steps.cli.outcome == 'failure'
shell: cmd
run: |
exit /b 1
- name: Remove php src to avoid cache
shell: pwsh
run: |
Remove-Item -Recurse -Force build\src\php-src