-
Notifications
You must be signed in to change notification settings - Fork 57
491 lines (428 loc) · 16.5 KB
/
Copy pathlinux-x64.yml
File metadata and controls
491 lines (428 loc) · 16.5 KB
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
name: Linux x64
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
COMPOSER_NO_INTERACTION: 1
COMPOSER_PROCESS_TIMEOUT: 0
jobs:
build:
# Compilation is always required; `--skip-tests` only suppresses downstream test jobs.
name: Build - PHP ${{ matrix.php }} ZTS
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
env:
PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx
steps:
- name: Checkout TypePHP
uses: actions/checkout@v4
- name: Checkout phpy
uses: actions/checkout@v4
with:
repository: swoole/phpy
path: third_party/phpy
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
ini-values: precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0
tools: composer:v2
env:
fail-fast: true
phpts: ts
update: true
- name: Show PHP environment
shell: bash
run: |
php -v
php-config --version
php --ini
php -r 'printf("PHP_ZTS=%d\nopcache.enable=%s\nopcache.enable_cli=%s\nopcache.jit=%s\nopcache.jit_buffer_size=%s\npcre.jit=%s\n", PHP_ZTS, ini_get("opcache.enable"), ini_get("opcache.enable_cli"), ini_get("opcache.jit"), ini_get("opcache.jit_buffer_size"), ini_get("pcre.jit"));'
- name: Verify ZTS PHP
shell: bash
run: |
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }'
case "$(php -r 'echo PHP_VERSION;')" in
"${{ matrix.php }}"*) ;;
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;;
esac
- name: Patch php_hash.h C++ compatibility
uses: ./.github/actions/patch-php-headers
- name: Install native build dependencies
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev
- name: Configure ZTS PHP embed library
shell: bash
run: |
php_home="$(php-config --prefix)"
embed_library="${php_home}/lib/libphp.so"
test -x "${php_home}/bin/php-config"
test -f "${embed_library}"
echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}"
echo "Using ZTS PHP $(php-config --version) embed library: ${embed_library}"
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Build PHPX
shell: bash
run: |
cmake -S "${PHPX_HOME}" -B "${PHPX_HOME}/build" \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTS=OFF \
-D BUILD_EXT=OFF \
-D GITHUB_ACTION=ON \
-D php_dir="${PHP_HOME}"
cmake --build "${PHPX_HOME}/build" --target phpx --parallel 2
test -f "${PHPX_HOME}/lib/libphpx.so"
- name: Build phpy
working-directory: third_party/phpy
run: |
phpize
./configure
make -j2
test -f modules/phpy.so
- name: Enable phpy extension
shell: bash
run: |
php_ini_dir="$(php-config --ini-dir)"
echo "extension=${GITHUB_WORKSPACE}/third_party/phpy/modules/phpy.so" \
| sudo tee "${php_ini_dir}/90-phpy.ini"
echo "PHP_INI_SCAN_DIR=${php_ini_dir}" >> "${GITHUB_ENV}"
php --ri phpy
- name: Configure native library path
shell: bash
run: echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${PHP_HOME}/lib" >> "${GITHUB_ENV}"
- name: Build tpc
shell: bash
run: |
php bin/tpc.php project.yml --job 2 --no-progress
test -x ./tpc
file ./tpc
file ./tpc | grep -Eiq 'x86-64|x86_64|amd64'
./tpc --version
- name: Upload Linux x64 build outputs
uses: actions/upload-artifact@v4
with:
name: tpc-linux-x64-php-${{ matrix.php }}-zts
if-no-files-found: error
retention-days: 7
path: |
tpc
vendor/swoole/phpx/lib/libphpx.so
third_party/phpy/modules/phpy.so
phpunit:
name: PHPUnit - PHP ${{ matrix.php }} ZTS
if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }}
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: build
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
env:
PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx
steps:
- name: Checkout TypePHP
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: curl, redis, mbstring, ffi
ini-values: ffi.enable=1, phpy.enable_operator_overloading=0, precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0
tools: composer:v2
env:
fail-fast: true
phpts: ts
update: true
- name: Show PHP environment
shell: bash
run: |
php -v
php-config --version
php --ini
php -r 'printf("PHP_ZTS=%d\nopcache.enable=%s\nopcache.enable_cli=%s\nopcache.jit=%s\nopcache.jit_buffer_size=%s\npcre.jit=%s\n", PHP_ZTS, ini_get("opcache.enable"), ini_get("opcache.enable_cli"), ini_get("opcache.jit"), ini_get("opcache.jit_buffer_size"), ini_get("pcre.jit"));'
- name: Verify ZTS PHP
shell: bash
run: |
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }'
case "$(php -r 'echo PHP_VERSION;')" in
"${{ matrix.php }}"*) ;;
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;;
esac
- name: Patch php_hash.h C++ compatibility
uses: ./.github/actions/patch-php-headers
- name: Install native build dependencies
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Download Linux x64 build outputs
uses: actions/download-artifact@v4
with:
name: tpc-linux-x64-php-${{ matrix.php }}-zts
path: .
- name: Verify Linux x64 build outputs
shell: bash
run: |
test -f ./tpc
test -f "${PHPX_HOME}/lib/libphpx.so"
test -f third_party/phpy/modules/phpy.so
chmod +x ./tpc
file ./tpc | grep -Eiq 'x86-64|x86_64|amd64'
- name: Enable phpy extension
shell: bash
run: |
php_ini_dir="$(php-config --ini-dir)"
echo "extension=${GITHUB_WORKSPACE}/third_party/phpy/modules/phpy.so" \
| sudo tee "${php_ini_dir}/90-phpy.ini"
echo "PHP_INI_SCAN_DIR=${php_ini_dir}" >> "${GITHUB_ENV}"
php --ri phpy
- name: Configure native library path
shell: bash
run: echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:$(php-config --prefix)/lib" >> "${GITHUB_ENV}"
- name: Run PHPUnit
run: vendor/bin/phpunit
integration:
name: EXT/LIB - PHP ${{ matrix.php }} ZTS
if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }}
runs-on: ubuntu-22.04
timeout-minutes: 45
needs: build
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
env:
PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx
steps:
- name: Checkout TypePHP
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
ini-values: precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0
tools: composer:v2
env:
fail-fast: true
phpts: ts
update: true
- name: Show PHP environment
shell: bash
run: |
php -v
php-config --version
php --ini
php -r 'printf("PHP_ZTS=%d\nopcache.enable=%s\nopcache.enable_cli=%s\nopcache.jit=%s\nopcache.jit_buffer_size=%s\npcre.jit=%s\n", PHP_ZTS, ini_get("opcache.enable"), ini_get("opcache.enable_cli"), ini_get("opcache.jit"), ini_get("opcache.jit_buffer_size"), ini_get("pcre.jit"));'
- name: Verify ZTS PHP and FPM
shell: bash
run: |
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }'
case "$(php -r 'echo PHP_VERSION;')" in
"${{ matrix.php }}"*) ;;
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;;
esac
php_home="$(php-config --prefix)"
php_fpm=""
for candidate in \
"${php_home}/sbin/php-fpm" \
"${php_home}/bin/php-fpm" \
"/usr/sbin/php-fpm${{ matrix.php }}" \
"/usr/bin/php-fpm${{ matrix.php }}"; do
if test -x "${candidate}"; then
php_fpm="${candidate}"
break
fi
done
test -n "${php_fpm}"
"${php_fpm}" -v
"${php_fpm}" -i > /tmp/typephp-fpm-info.txt
grep -q 'Thread Safety => enabled' /tmp/typephp-fpm-info.txt
echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}"
echo "PHP_FPM=${php_fpm}" >> "${GITHUB_ENV}"
- name: Patch php_hash.h C++ compatibility
uses: ./.github/actions/patch-php-headers
- name: Install native build dependencies
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Download Linux x64 build outputs
uses: actions/download-artifact@v4
with:
name: tpc-linux-x64-php-${{ matrix.php }}-zts
path: .
- name: Verify integration build inputs
shell: bash
run: |
test -f ./tpc
test -f "${PHPX_HOME}/lib/libphpx.so"
test -f "${PHP_HOME}/lib/libphp.so"
chmod +x ./tpc
echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${PHP_HOME}/lib" >> "${GITHUB_ENV}"
- name: Run EXT/LIB integration tests
shell: bash
run: |
php -n bin/run-integration-tests.php \
--compiler=./tpc \
--php="$(command -v php)" \
--php-fpm="${PHP_FPM}"
- name: Upload integration failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-failures-linux-x64-php-${{ matrix.php }}-zts
if-no-files-found: ignore
retention-days: 7
path: build/integration-*
phpt:
name: PHPT - PHP ${{ matrix.php }} ZTS
if: ${{ startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message || '', '--skip-tests') }}
runs-on: ubuntu-22.04
timeout-minutes: 180
needs: build
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
env:
PHPX_HOME: ${{ github.workspace }}/vendor/swoole/phpx
NO_INTERACTION: 1
REPORT_EXIT_STATUS: 1
TYPEPHP_PHPT_GENERATED_ARTIFACT_DIR: ${{ github.workspace }}/build/phpt-generated
steps:
- name: Checkout TypePHP
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: curl, redis, mbstring, ffi
ini-values: ffi.enable=1, phpy.enable_operator_overloading=0, precision=17, memory_limit=4G, error_reporting=E_ERROR|E_WARNING, display_errors=1, display_startup_errors=1, log_errors=0
tools: composer:v2
env:
fail-fast: true
phpts: ts
update: true
- name: Show PHP environment
shell: bash
run: |
php -v
php-config --version
php --ini
php -r 'printf("PHP_ZTS=%d\nopcache.enable=%s\nopcache.enable_cli=%s\nopcache.jit=%s\nopcache.jit_buffer_size=%s\npcre.jit=%s\n", PHP_ZTS, ini_get("opcache.enable"), ini_get("opcache.enable_cli"), ini_get("opcache.jit"), ini_get("opcache.jit_buffer_size"), ini_get("pcre.jit"));'
- name: Verify ZTS PHP
shell: bash
run: |
php -r 'if (!PHP_ZTS) { fwrite(STDERR, "Expected a ZTS PHP build\n"); exit(1); }'
case "$(php -r 'echo PHP_VERSION;')" in
"${{ matrix.php }}"*) ;;
*) echo "setup-php installed an unexpected PHP version" >&2; exit 1 ;;
esac
- name: Patch php_hash.h C++ compatibility
uses: ./.github/actions/patch-php-headers
- name: Install native build dependencies
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake libgmp-dev libmpfr-dev pkg-config python3-dev
- name: Configure ZTS PHP embed library
shell: bash
run: |
php_home="$(php-config --prefix)"
embed_library="${php_home}/lib/libphp.so"
test -x "${php_home}/bin/php-config"
test -f "${embed_library}"
echo "PHP_HOME=${php_home}" >> "${GITHUB_ENV}"
echo "Using ZTS PHP $(php-config --version) embed library: ${embed_library}"
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Download Linux x64 build outputs
uses: actions/download-artifact@v4
with:
name: tpc-linux-x64-php-${{ matrix.php }}-zts
path: .
- name: Verify Linux x64 build outputs
shell: bash
run: |
test -f ./tpc
test -f "${PHPX_HOME}/lib/libphpx.so"
test -f third_party/phpy/modules/phpy.so
chmod +x ./tpc
file ./tpc | grep -Eiq 'x86-64|x86_64|amd64'
- name: Enable phpy extension
shell: bash
run: |
php_ini_dir="$(php-config --ini-dir)"
echo "extension=${GITHUB_WORKSPACE}/third_party/phpy/modules/phpy.so" \
| sudo tee "${php_ini_dir}/90-phpy.ini"
echo "PHP_INI_SCAN_DIR=${php_ini_dir}" >> "${GITHUB_ENV}"
php --ri phpy
- name: Configure native library path
shell: bash
run: |
test -f "${PHPX_HOME}/lib/libphpx.so"
test -f "${PHP_HOME}/lib/libphp.so"
echo "LD_LIBRARY_PATH=${PHPX_HOME}/lib:${PHP_HOME}/lib" >> "${GITHUB_ENV}"
- name: Show build environment
run: |
./tpc --version
php -v
php --ini
ldd ./tpc | grep -E 'libphp(x)?[0-9.]*\.so'
cmake --version
c++ --version
- name: Run compiler PHPT suite with bootstrap compiler
run: |
mkdir -p build
php run-tests.php -q -j8 --compiler ./tpc \
-w build/failed-tests.txt -W build/test-results.txt tests/compiler
- name: Package tested Linux compiler
if: startsWith(github.ref, 'refs/tags/') && matrix.php == '8.5'
shell: bash
run: |
composer install --no-dev --prefer-dist --no-progress --classmap-authoritative
export TYPEPHP_PACKAGE_VERSION="${GITHUB_REF_NAME}"
php package.php
test "$(find . -maxdepth 1 -name 'tpc_v*_linux_*.tar.gz' -type f | wc -l)" -eq 1
- name: Upload Linux release package
if: startsWith(github.ref, 'refs/tags/') && matrix.php == '8.5'
uses: actions/upload-artifact@v4
with:
name: release-linux-x64-php-${{ matrix.php }}-zts
if-no-files-found: error
retention-days: 1
path: tpc_v*_linux_*.tar.gz
- name: Upload PHPT failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: phpt-failures-linux-x64-php-${{ matrix.php }}-zts
if-no-files-found: ignore
retention-days: 7
path: |
build/failed-tests.txt
build/test-results.txt
build/**/*.cc
build/**/*.h
php_test_results_*.txt
tests/compiler/**/*.diff
tests/compiler/**/*.log
tests/compiler/**/*.out