-
-
Notifications
You must be signed in to change notification settings - Fork 8
339 lines (284 loc) · 10.8 KB
/
ci.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Build PHP
on:
push:
pull_request:
repository_dispatch:
workflow_dispatch:
inputs:
build-mode:
description: 'Build mode: --build-all or --build--new'
default: '--build-new'
required: false
php-source:
description: 'PHP source: --web-php or --php-src'
default: '--web-php'
required: false
php-versions:
description: 'PHP version to build'
default: '5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4'
required: false
container-os-versions:
description: 'OS versions to build on'
default: 'ubuntu:20.04 ubuntu:22.04 ubuntu:24.04 debian:10 debian:11 debian:12'
required: false
schedule:
- cron: '0 0 1-31/2 * *'
env:
CONTAINER_OS_LIST: ubuntu:20.04 ubuntu:22.04 ubuntu:24.04 debian:10 debian:11 debian:12
RUNNER_OS_LIST: ubuntu-20.04 ubuntu-22.04
PHP_LIST: 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4
SAPI_LIST: apache2 cgi cli embed fpm phpdbg
BUILD_LIST: nts zts
jobs:
get-matrix:
runs-on: ubuntu-latest
outputs:
container_only: ${{ steps.set-matrix.outputs.container_only }}
container_os_matrix: ${{ steps.set-matrix.outputs.container_os_matrix }}
runner_os_matrix: ${{ steps.set-matrix.outputs.runner_os_matrix }}
test_container_os_matrix: ${{ steps.set-matrix.outputs.test_container_os_matrix }}
test_runner_os_matrix: ${{ steps.set-matrix.outputs.test_runner_os_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get matrix
id: set-matrix
env:
COMMIT: ${{ github.event.head_commit.message || github.event.inputs.build-mode }}
CONTAINER_OS_LIST: ${{ github.event.inputs.container-os-versions || env.CONTAINER_OS_LIST }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUNNER_OS_LIST: ${{ env.RUNNER_OS_LIST }}
PHP_LIST: ${{ github.event.inputs.php-versions || env.PHP_LIST }}
PHP_SOURCE: ${{ github.event.inputs.php-source }}
SAPI_LIST: ${{ env.SAPI_LIST }}
BUILD_LIST: ${{ env.BUILD_LIST }}
run: bash scripts/get-matrix.sh
build:
needs: get-matrix
if: "!contains(github.event.head_commit.message, 'skip-build')"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-matrix.outputs.container_os_matrix)}}
env:
BUILD: ${{ matrix.build }}
GITHUB_MESSAGE: ${{ github.event.head_commit.message || github.event.inputs.build-mode }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHP_VERSION: ${{ matrix.php-version }}
PHP_SOURCE: ${{ github.event.inputs.php-source }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install required packages
run: bash scripts/install-requirements.sh
env:
BUILD: ${{ matrix.build }}
- name: Build and package apache2
if: contains(env.SAPI_LIST, 'apache2')
run: bash scripts/build.sh build_sapi apache2
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Build and package cgi
if: contains(env.SAPI_LIST, 'cgi')
run: bash scripts/build.sh build_sapi cgi
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Build and package cli
if: contains(env.SAPI_LIST, 'cli')
run: bash scripts/build.sh build_sapi cli
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Build and package embed
if: contains(env.SAPI_LIST, 'embed')
run: bash scripts/build.sh build_sapi embed
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Build and package fpm
if: contains(env.SAPI_LIST, 'fpm')
run: bash scripts/build.sh build_sapi fpm
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Build and package phpdbg
if: contains(env.SAPI_LIST, 'phpdbg')
run: bash scripts/build.sh build_sapi phpdbg
env:
SAPI_LIST: ${{ env.SAPI_LIST }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: php-sapi${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
path: /tmp/debian/*.zst
merge:
needs: [get-matrix, build]
if: "!contains(github.event.head_commit.message, 'skip-merge')"
container: ${{ matrix.container }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-matrix.outputs.container_os_matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install required packages
run: bash scripts/install-requirements.sh
env:
BUILD: ${{ matrix.build }}
PHP_VERSION: ${{ matrix.php-version }}
- uses: actions/download-artifact@v3
with:
name: php-sapi${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}-${{ matrix.dist-version }}
path: /tmp
- name: Stage builds
shell: bash
run: |
mkdir -p /tmp/debian
for sapi_build in /tmp/*.zst; do
tar -I zstd -xf "$sapi_build" -C /tmp/debian
rm -f "$sapi_build"
done
- name: Build and package
run: bash scripts/build.sh merge
env:
BUILD: ${{ matrix.build }}
SAPI_LIST: ${{ env.SAPI_LIST }}
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_MESSAGE: ${{ github.event.head_commit.message || github.event.inputs.build-mode }}
GITHUB_NAME: 'Shivam Mathur'
GITHUB_EMAIL: ${{ secrets.email }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_WORKSPACE: ${{ github.workspace }}
PHP_VERSION: ${{ matrix.php-version }}
PHP_SOURCE: ${{ github.event.inputs.php-source }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: php${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}
path: |
/tmp/*.xz
/tmp/*.zst
- name: Check php-cli version
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
- name: Check php-cgi version
run: php-cgi -v
- name: Check php-fpm version
run: php-fpm -v && php-fpm -t
- name: Check phpdbg version
run: phpdbg -V
- name: Check pecl version
run: pecl -V
- name: Check php-config version
run: php-config --version
- name: Check phpize version
run: phpize -v
- name: Check php extensions
run: bash scripts/test_extensions.sh
env:
PHP_VERSION: ${{ matrix.php-version }}
local-test:
needs: [merge, build, get-matrix]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-local-test')"
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-matrix.outputs.test_container_os_matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: php${{ matrix.php-version }}-${{ matrix.build }}+${{ matrix.dist }}
path: /tmp
- name: Install PHP
run: |
sed -i '/download/d' scripts/install.sh
bash scripts/install.sh ${{ matrix.php-version }} local ${{ matrix.debug }} ${{ matrix.build }}
- name: Test
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
php -m
- name: Check GD support
run: php -r "print_r(gd_info());"
- name: Test pecl
run: bash scripts/test_pecl.sh
env:
PHP_VERSION: ${{ matrix.php-version }}
- name: Check SAPI
run: bash scripts/test_sapi.sh
env:
PHP_VERSION: ${{ matrix.php-version }}
github-test:
needs: [merge, build, get-matrix]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'skip-github-test') && contains(needs.get-matrix.outputs.container_only, 'false')"
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-matrix.outputs.test_runner_os_matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: php${{ matrix.php-version }}-${{ matrix.build }}+ubuntu
path: /tmp
- name: Install PHP
run: |
sed -i '/download/d' scripts/install.sh
bash scripts/install.sh ${{ matrix.php-version }} github ${{ matrix.debug }} ${{ matrix.build }}
- name: Test
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
php -m
- name: Test pecl
run: bash scripts/test_pecl.sh
env:
PHP_VERSION: ${{ matrix.php-version }}
- name: Check SAPI
run: bash scripts/test_sapi.sh
env:
PHP_VERSION: ${{ matrix.php-version }}
release-container-only:
needs: [get-matrix, local-test]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'true')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create builds directory
run: mkdir builds
- uses: actions/download-artifact@v3
with:
path: builds
- name: Release
run: bash scripts/release.sh
env:
GITHUB_MESSAGE: ${{ github.event.head_commit.message || github.event.inputs.build-mode }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHP_LIST: ${{ github.event.inputs.php-versions || env.PHP_LIST }}
PHP_SOURCE: ${{ github.event.inputs.php-source }}
release:
needs: [get-matrix, local-test, github-test]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-release') && contains(needs.get-matrix.outputs.container_only, 'false')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create builds directory
run: mkdir builds
- uses: actions/download-artifact@v3
with:
path: builds
- name: Release
run: bash scripts/release.sh
env:
GITHUB_MESSAGE: ${{ github.event.head_commit.message || github.event.inputs.build-mode }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHP_LIST: ${{ github.event.inputs.php-versions || env.PHP_LIST }}
PHP_SOURCE: ${{ github.event.inputs.php-source }}