Skip to content

Commit a149397

Browse files
authored
ci: trim PR matrix, shard behat, skip docs-only runs (#7931)
1 parent 90875fb commit a149397

1 file changed

Lines changed: 36 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- '[0-9]+.[0-9]+'
8+
paths-ignore:
9+
- '**.md'
10+
- '**.rst'
11+
- 'docs/**'
512
pull_request:
13+
paths-ignore:
14+
- '**.md'
15+
- '**.rst'
16+
- 'docs/**'
617

718
concurrency:
819
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -235,15 +246,8 @@ jobs:
235246
timeout-minutes: 20
236247
strategy:
237248
matrix:
238-
php:
239-
- '8.2'
240-
- '8.3'
241-
- '8.4'
242-
- '8.5'
249+
php: ${{ fromJSON(github.event_name == 'pull_request' && '["8.2","8.5"]' || '["8.2","8.3","8.4","8.5"]') }}
243250
include:
244-
- php: '8.2'
245-
- php: '8.3'
246-
- php: '8.4'
247251
- php: '8.5'
248252
coverage: true
249253
fail-fast: false
@@ -311,16 +315,7 @@ jobs:
311315
timeout-minutes: 20
312316
strategy:
313317
matrix:
314-
php:
315-
- version: '8.2'
316-
- version: '8.3'
317-
- version: '8.4'
318-
- version: '8.5'
319-
coverage: true
320-
- version: '8.5'
321-
lowest: true
322-
- version: '8.5'
323-
minimal-changes: true
318+
php: ${{ fromJSON(github.event_name == 'pull_request' && '[{"version":"8.2"},{"version":"8.5","coverage":true},{"version":"8.5","lowest":true},{"version":"8.5","minimal-changes":true}]' || '[{"version":"8.2"},{"version":"8.3"},{"version":"8.4"},{"version":"8.5","coverage":true},{"version":"8.5","lowest":true},{"version":"8.5","minimal-changes":true}]') }}
324319
component:
325320
- api-platform/doctrine-common
326321
- api-platform/doctrine-orm
@@ -459,21 +454,20 @@ jobs:
459454
./vendor/bin/phpunit --fail-on-deprecation --display-deprecations --log-junit "/tmp/build/logs/phpunit/junit.xml"
460455
461456
behat:
462-
name: Behat (PHP ${{ matrix.php }})
457+
name: Behat (PHP ${{ matrix.php }} ${{ matrix.shard }})
463458
runs-on: ubuntu-latest
464459
timeout-minutes: 20
465460
strategy:
466461
matrix:
467-
php:
468-
- '8.2'
469-
- '8.3'
470-
- '8.4'
471-
- '8.5'
462+
php: ${{ fromJSON(github.event_name == 'pull_request' && '["8.2","8.5"]' || '["8.2","8.3","8.4","8.5"]') }}
463+
shard:
464+
- main
465+
- ld-api-hal-hydra
466+
- graphql-doctrine
467+
- misc
472468
include:
473-
- php: '8.2'
474-
- php: '8.3'
475-
- php: '8.4'
476469
- php: '8.5'
470+
shard: main
477471
coverage: true
478472
fail-fast: false
479473
steps:
@@ -506,10 +500,20 @@ jobs:
506500
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
507501
- name: Clear test app cache
508502
run: tests/Fixtures/app/console cache:clear --ansi
509-
- name: Run Behat tests (PHP ${{ matrix.php }})
503+
- name: Resolve shard paths
504+
id: shard
505+
run: |
506+
case "${{ matrix.shard }}" in
507+
main) paths="features/main" ;;
508+
ld-api-hal-hydra) paths="features/jsonld features/jsonapi features/hal features/hydra" ;;
509+
graphql-doctrine) paths="features/graphql features/doctrine" ;;
510+
misc) paths="features/authorization features/filter features/issues features/security features/serializer features/http_cache features/sub_resources features/json features/xml features/push_relations features/mercure" ;;
511+
esac
512+
echo "paths=$paths" >> $GITHUB_OUTPUT
513+
- name: Run Behat tests (PHP ${{ matrix.php }} ${{ matrix.shard }})
510514
run: |
511515
mkdir -p build/logs/behat
512-
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --no-interaction ${{ matrix.coverage && '--profile=default-coverage' || '--profile=default' }}
516+
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --no-interaction ${{ matrix.coverage && '--profile=default-coverage' || '--profile=default' }} ${{ steps.shard.outputs.paths }}
513517
- name: Merge code coverage reports
514518
if: matrix.coverage
515519
run: |
@@ -522,15 +526,15 @@ jobs:
522526
if: always()
523527
uses: actions/upload-artifact@v6
524528
with:
525-
name: behat-logs-php${{ matrix.php }}
529+
name: behat-logs-php${{ matrix.php }}-shard${{ matrix.shard }}
526530
path: build/logs/behat
527531
continue-on-error: true
528532
- name: Upload coverage results to Codecov
529533
if: matrix.coverage
530534
uses: codecov/codecov-action@v5
531535
with:
532536
directory: build/logs/behat
533-
name: behat-php${{ matrix.php }}
537+
name: behat-php${{ matrix.php }}-shard${{ matrix.shard }}
534538
flags: behat
535539
fail_ci_if_error: true
536540
continue-on-error: true
@@ -1406,15 +1410,8 @@ jobs:
14061410
timeout-minutes: 20
14071411
strategy:
14081412
matrix:
1409-
php:
1410-
- '8.2'
1411-
- '8.3'
1412-
- '8.4'
1413-
- '8.5'
1413+
php: ${{ fromJSON(github.event_name == 'pull_request' && '["8.2","8.5"]' || '["8.2","8.3","8.4","8.5"]') }}
14141414
include:
1415-
- php: '8.2'
1416-
- php: '8.3'
1417-
- php: '8.4'
14181415
- php: '8.5'
14191416
coverage: true
14201417
fail-fast: false

0 commit comments

Comments
 (0)