-
Notifications
You must be signed in to change notification settings - Fork 187
484 lines (409 loc) · 18.4 KB
/
Copy pathtests.yaml
File metadata and controls
484 lines (409 loc) · 18.4 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
name: CI
on:
pull_request:
push:
branches:
- master
- release/**
permissions:
contents: read
env:
FRANKENPHP_VERSION: v1.11.2
ROADRUNNER_VERSION: v2025.1.7
COMPOSER_ADVISORY_SYMFONY_COMMON: >-
[
"PKSA-z7t6-zt6p-wtng",
"PKSA-5r1g-c7b7-y1zg",
"PKSA-4k7v-pfvw-nqvp",
"PKSA-365x-2zjk-pt47",
"PKSA-b35n-565h-rs4q",
"PKSA-4wjj-gy1p-ft3r",
"PKSA-wws7-mr54-jsny",
"PKSA-bf7t-jnpz-492k",
"PKSA-yc7t-91v9-99xs",
"PKSA-c28x-6bj5-8spx",
"PKSA-tbsf-h7vc-j7hn",
"PKSA-v5yj-8nmz-sk2q",
"PKSA-ft77-7h5f-p3r6",
"PKSA-b14r-zh1d-vdrc"
]
COMPOSER_ADVISORY_SYMFONY_4_4_AND_5_LOWEST: >-
[
"PKSA-wtxr-p26d-nn42",
"PKSA-2n2k-66v2-bwg3",
"PKSA-rkkf-636k-qjb3"
]
COMPOSER_ADVISORY_SYMFONY_5_LOWEST_AND_6: >-
[
"PKSA-ztgh-x9c8-k66g"
]
COMPOSER_ADVISORY_SYMFONY_5_LOWEST_ONLY: >-
[
"PKSA-hr4y-jwk2-1yb9",
"PKSA-8knv-7jsn-12w8"
]
COMPOSER_ADVISORY_SYMFONY_6_PHP_8_0_ONLY: >-
[
"PKSA-rqvm-b18n-vg69",
"PKSA-5x8m-77gx-t86z"
]
COMPOSER_ADVISORY_TWIG: >-
[
"PKSA-8zx5-v2nz-58pb",
"PKSA-fbvq-z33h-r2np",
"PKSA-g9zw-qxh8-pq8w",
"PKSA-yd6k-t2gh-1m43",
"PKSA-1tmc-rt7x-12w6",
"PKSA-xx6c-6d96-db2w",
"PKSA-sjvz-tbbr-vwth",
"PKSA-h8hf-ytnd-5t9q",
"PKSA-kvv6-36cr-fkzb",
"PKSA-n14z-jjjg-g8vd",
"PKSA-3mcc-k66d-pydb",
"PKSA-dpx1-78wg-1kqs",
"PKSA-yhcn-xrg3-68b1",
"PKSA-2wrf-1xmk-1pky",
"PKSA-6319-ffpf-gx66",
"PKSA-n7sg-8f52-pqtf"
]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
symfony-version:
- 4.4.*
- 5.*
- 6.*
- 7.*
- 8.*
dependencies:
- highest
exclude:
- php: '7.2'
symfony-version: 6.*
- php: '7.3'
symfony-version: 6.*
- php: '7.4'
symfony-version: 6.*
- php: '7.2'
symfony-version: 7.*
- php: '7.3'
symfony-version: 7.*
- php: '7.4'
symfony-version: 7.*
- php: '8.0'
symfony-version: 7.*
- php: '8.1'
symfony-version: 7.*
- php: '8.4'
symfony-version: 4.4.*
- php: '8.5'
symfony-version: 4.4.*
- php: '7.2'
symfony-version: 8.*
- php: '7.3'
symfony-version: 8.*
- php: '7.4'
symfony-version: 8.*
- php: '8.0'
symfony-version: 8.*
- php: '8.1'
symfony-version: 8.*
- php: '8.2'
symfony-version: 8.*
- php: '8.3'
symfony-version: 8.*
include:
- php: '7.2'
symfony-version: 4.4.*
dependencies: lowest
- php: '7.2'
symfony-version: 5.*
dependencies: lowest
- php: '8.0'
symfony-version: 6.*
dependencies: lowest
- php: '8.2'
symfony-version: 7.*
dependencies: lowest
- php: '8.4'
symfony-version: 8.*
dependencies: lowest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@728c6c6b8cf02c2e48117716a91ee48313958a19 # v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
tools: flex
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
- name: Remove unused dependencies
run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update
- name: Remove RoadRunner dependencies on unsupported PHP versions
if: ${{ runner.os == 'Windows' || matrix.php == '7.2' || matrix.php == '7.3' || matrix.php == '7.4' || matrix.php == '8.0' }}
run: composer remove spiral/roadrunner-http spiral/roadrunner-worker --dev --no-interaction --no-update
- name: Use PHPUnit 9 for lowest dependencies on newer PHP versions
if: ${{ matrix.dependencies == 'lowest' && matrix.php != '7.2' }}
run: composer require phpunit/phpunit:^9.6.34 --dev --no-interaction --no-update
# The following tasks add security advisories to the allowlist to allow proper composer resolution
# They are as strict as possible and bound to particular versions so that we only ignore a well known set.
# If new ones appear, they will fail CI and will require investigation
# The rationale behind that is that we don't want to ignore them for all versions and instead only
# ignore them if absolutely necessary for resolution so that composer can select versions without security
# concerns if available
- name: Configure common Symfony advisory allowlist
if: ${{ matrix.symfony-version == '4.4.*' || (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') || (matrix.symfony-version == '6.*' && matrix.php == '8.0') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_COMMON"
- name: Configure Symfony 4.4/5 lowest advisory allowlist
if: ${{ matrix.symfony-version == '4.4.*' || (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_4_4_AND_5_LOWEST"
- name: Configure Symfony 5 lowest/6 advisory allowlist
if: ${{ (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') || (matrix.symfony-version == '6.*' && matrix.php == '8.0') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_5_LOWEST_AND_6"
- name: Configure Symfony 5 lowest advisory allowlist
if: ${{ matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest' }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_5_LOWEST_ONLY"
- name: Configure Symfony 6 advisory allowlist
if: ${{ matrix.symfony-version == '6.*' && matrix.php == '8.0' }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_6_PHP_8_0_ONLY"
- name: Configure Twig advisory allowlist
if: ${{ contains(fromJSON('["4.4.*","5.*","6.*"]'), matrix.symfony-version) && contains(fromJSON('["7.2","7.3","7.4","8.0"]'), matrix.php) }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_TWIG"
# End of security advisory tasks
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-scripts --no-audit
if: ${{ matrix.dependencies == 'highest' }}
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest --no-install --no-scripts --no-audit
if: ${{ matrix.dependencies == 'lowest' }}
- name: Audit dependencies
run: composer audit --locked --no-interaction --format=table --abandoned=report
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --no-scripts
- name: Run tests
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5
with:
file: build/coverage-report.xml
token: ${{ secrets.CODECOV_TOKEN }}
missing-optional-packages-tests:
name: Tests without optional packages
runs-on: ubuntu-latest
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
strategy:
fail-fast: false
matrix:
include:
- php: '7.2'
dependencies: lowest
symfony-version: 4.4.*
- php: '7.4'
dependencies: highest
- php: '8.0'
dependencies: lowest
symfony-version: 4.4.*
- php: '8.4'
dependencies: highest
symfony-version: 8.*
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: Setup PHP
uses: shivammathur/setup-php@728c6c6b8cf02c2e48117716a91ee48313958a19 # v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
tools: flex
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
- name: Remove unused dependencies
run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update
- name: Remove RoadRunner dependencies on unsupported PHP versions
if: ${{ runner.os == 'Windows' || matrix.php == '7.2' || matrix.php == '7.3' || matrix.php == '7.4' || matrix.php == '8.0' }}
run: composer remove spiral/roadrunner-http spiral/roadrunner-worker --dev --no-interaction --no-update
- name: Remove optional packages
run: composer remove doctrine/dbal doctrine/doctrine-bundle symfony/messenger symfony/twig-bundle symfony/cache symfony/http-client --dev --no-update
- name: Use PHPUnit 9 for lowest dependencies on newer PHP versions
if: ${{ matrix.dependencies == 'lowest' && matrix.php != '7.2' }}
run: composer require phpunit/phpunit:^9.6.34 --dev --no-interaction --no-update
# The following tasks add security advisories to the allowlist to allow proper composer resolution
# They are as strict as possible and bound to particular versions so that we only ignore a well known set.
# If new ones appear, they will fail CI and will require investigation
# The rationale behind that is that we don't want to ignore them for all versions and instead only
# ignore them if absolutely necessary for resolution so that composer can select versions without security
# concerns if available
- name: Configure common Symfony advisory allowlist
if: ${{ matrix.symfony-version == '4.4.*' || (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') || (matrix.symfony-version == '6.*' && matrix.php == '8.0') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_COMMON"
- name: Configure Symfony 4.4/5 lowest advisory allowlist
if: ${{ matrix.symfony-version == '4.4.*' || (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_4_4_AND_5_LOWEST"
- name: Configure Symfony 5 lowest/6 advisory allowlist
if: ${{ (matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest') || (matrix.symfony-version == '6.*' && matrix.php == '8.0') }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_5_LOWEST_AND_6"
- name: Configure Symfony 5 lowest advisory allowlist
if: ${{ matrix.symfony-version == '5.*' && matrix.php == '7.2' && matrix.dependencies == 'lowest' }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_5_LOWEST_ONLY"
- name: Configure Symfony 6 advisory allowlist
if: ${{ matrix.symfony-version == '6.*' && matrix.php == '8.0' }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_SYMFONY_6_PHP_8_0_ONLY"
- name: Configure Twig advisory allowlist
if: ${{ contains(fromJSON('["4.4.*","5.*","6.*"]'), matrix.symfony-version) && contains(fromJSON('["7.2","7.3","7.4","8.0"]'), matrix.php) }}
run: composer config --merge --json policy.advisories.ignore-id "$COMPOSER_ADVISORY_TWIG"
# End of security advisory tasks
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-scripts --no-audit
if: ${{ matrix.dependencies == 'highest' }}
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest --no-install --no-scripts --no-audit
if: ${{ matrix.dependencies == 'lowest' }}
- name: Audit dependencies
run: composer audit --locked --no-interaction --format=table --abandoned=report
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --no-scripts
- name: Run tests
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
- name: Upload code coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5
with:
file: build/coverage-report.xml
token: ${{ secrets.CODECOV_TOKEN }}
runtime-tests-frankenphp:
name: Runtime tests (FrankenPHP)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Determine Composer cache directory
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Cache Composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-runtime-frankenphp-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-runtime-frankenphp-composer-
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-scripts --no-audit
- name: Audit dependencies
run: composer audit --locked --no-interaction --format=table --abandoned=report
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --no-scripts
- name: Install FrankenPHP
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
case "$(uname -m)" in
x86_64) asset="frankenphp-linux-x86_64" ;;
aarch64|arm64) asset="frankenphp-linux-aarch64" ;;
*) echo "Unsupported architecture: $(uname -m)"; exit 1 ;;
esac
digest="$(gh api "repos/php/frankenphp/releases/tags/${FRANKENPHP_VERSION}" --jq ".assets[] | select(.name == \"${asset}\") | .digest")"
if [ -z "${digest}" ]; then
echo "Unable to resolve digest for ${asset} (${FRANKENPHP_VERSION})."
exit 1
fi
gh release download "${FRANKENPHP_VERSION}" \
--repo php/frankenphp \
--pattern "${asset}" \
--output "${asset}"
echo "${digest#sha256:} ${asset}" | sha256sum --check --
mkdir -p "${RUNNER_TEMP}/bin"
install -m 0755 "${asset}" "${RUNNER_TEMP}/bin/frankenphp"
echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
"${RUNNER_TEMP}/bin/frankenphp" version
shell: bash
- name: Run full PHPUnit test suite
run: vendor/bin/phpunit --verbose
runtime-tests-roadrunner:
name: Runtime tests (RoadRunner)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Determine Composer cache directory
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Cache Composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-runtime-roadrunner-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-runtime-roadrunner-composer-
- name: Resolve dependencies
run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-scripts --no-audit
- name: Audit dependencies
run: composer audit --locked --no-interaction --format=table --abandoned=report
- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --no-scripts
- name: Install RoadRunner
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
case "$(uname -m)" in
x86_64) arch="amd64" ;;
aarch64|arm64) arch="arm64" ;;
*) echo "Unsupported architecture: $(uname -m)"; exit 1 ;;
esac
version_no_prefix="${ROADRUNNER_VERSION#v}"
asset="roadrunner-${version_no_prefix}-linux-${arch}.tar.gz"
digest="$(gh api "repos/roadrunner-server/roadrunner/releases/tags/${ROADRUNNER_VERSION}" --jq ".assets[] | select(.name == \"${asset}\") | .digest")"
if [ -z "${digest}" ]; then
echo "Unable to resolve digest for ${asset} (${ROADRUNNER_VERSION})."
exit 1
fi
gh release download "${ROADRUNNER_VERSION}" \
--repo roadrunner-server/roadrunner \
--pattern "${asset}" \
--output "${asset}"
echo "${digest#sha256:} ${asset}" | sha256sum --check --
tar -xzf "${asset}" --strip-components=1 "${asset%.tar.gz}/rr"
mkdir -p "${RUNNER_TEMP}/bin"
install -m 0755 rr "${RUNNER_TEMP}/bin/rr"
echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
"${RUNNER_TEMP}/bin/rr" --version
shell: bash
- name: Run full PHPUnit test suite
run: vendor/bin/phpunit --verbose