Skip to content

Commit 4e299a6

Browse files
authored
ci(behavior): parallelize tests by browser x shard matrix (#2903)
* ci(behavior): parallelize tests by browser x shard matrix Expands the behavior test matrix from 3 shards (each running all browsers) to 12 jobs (3 browsers x 4 shards). Each job installs only the browser it needs and uses a browser-scoped Playwright cache key. Local measurement showed a 1/9 slice at ~4 min on 2 workers; 1/12 should land ~3 min of tests + 2.5 min setup, well under the previous ~20 min wall time. * ci(behavior): self-trigger on workflow file changes --------- Co-authored-by: Caio Pizzol <caio@superdoc.dev>
1 parent 9adf23e commit 4e299a6

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/ci-behavior.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- 'packages/preset-geometry/**'
1616
- 'tests/behavior/**'
1717
- 'shared/**'
18+
- '.github/workflows/ci-behavior.yml'
1819
- '!**/*.md'
1920
merge_group:
2021
workflow_dispatch:
@@ -29,7 +30,8 @@ jobs:
2930
strategy:
3031
fail-fast: false
3132
matrix:
32-
shard: [1, 2, 3]
33+
browser: [chromium, firefox, webkit]
34+
shard: [1, 2, 3, 4]
3335
steps:
3436
- uses: actions/checkout@v6
3537

@@ -56,20 +58,20 @@ jobs:
5658
id: pw-cache
5759
with:
5860
path: ~/.cache/ms-playwright
59-
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
61+
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-${{ matrix.browser }}
6062

61-
- name: Install Playwright browsers
63+
- name: Install Playwright browser
6264
if: steps.pw-cache.outputs.cache-hit != 'true'
63-
run: pnpm exec playwright install --with-deps chromium firefox webkit
65+
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}
6466
working-directory: tests/behavior
6567

6668
- name: Install Playwright system deps
6769
if: steps.pw-cache.outputs.cache-hit == 'true'
68-
run: pnpm exec playwright install-deps chromium firefox webkit
70+
run: pnpm exec playwright install-deps ${{ matrix.browser }}
6971
working-directory: tests/behavior
7072

71-
- name: Run behavior tests (shard ${{ matrix.shard }}/3)
72-
run: pnpm exec playwright test --shard=${{ matrix.shard }}/3
73+
- name: Run behavior tests (${{ matrix.browser }} shard ${{ matrix.shard }}/4)
74+
run: pnpm exec playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}/4
7375
working-directory: tests/behavior
7476

7577
validate:

0 commit comments

Comments
 (0)