Skip to content

Commit 2e3fea6

Browse files
committed
ci: shard the editor's Firefox browser tests
The Firefox job ran every package's Firefox suite in one job, and the editor's suite alone took 1541 s of the job's 26.6 minutes on an uncached run, while Chromium and WebKit finished in about 19. Firefox was the slowest required check on every pull request. Run Firefox as three parts: the editor's suite split with Vitest's `--shard=1/2` and `--shard=2/2`, and one part for every other package. The shard argument is passed after Turbo's `--`, so each shard has its own cache key. A `Browser tests (firefox)` job needs all three parts and fails unless they all succeed, so the required check keeps its name. Trace artifacts are named per part. Chromium and WebKit run as before, and the racejar example still runs once, with Chromium.
1 parent 0b5aa03 commit 2e3fea6

1 file changed

Lines changed: 47 additions & 4 deletions

File tree

‎.github/workflows/test-browser.yml‎

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
os: [ubuntu-latest]
37-
browser: [chromium, firefox, webkit]
37+
browser: [chromium, webkit]
3838
node: [lts/*]
3939
experimental: [false]
4040

41-
steps:
41+
steps: &steps
4242
- uses: actions/checkout@v7
4343
- uses: pnpm/action-setup@v6
4444
- uses: actions/setup-node@v6
@@ -53,7 +53,7 @@ jobs:
5353
run: |
5454
node -v
5555
pnpm -v
56-
pnpm test:browser:${{ matrix.browser }} --concurrency=2 -- --browser.trace=retain-on-failure
56+
pnpm test:browser:${{ matrix.browser }} ${{ matrix.part.turbo }} --concurrency=2 -- --browser.trace=retain-on-failure ${{ matrix.part.vitest }}
5757
5858
- name: racejar Playwright example
5959
if: matrix.browser == 'chromium'
@@ -65,9 +65,52 @@ jobs:
6565
if: failure() && steps.test.outcome == 'failure'
6666
uses: actions/upload-artifact@v7
6767
with:
68-
name: browser-traces-${{ matrix.browser }}
68+
name: browser-traces-${{ matrix.browser }}${{ matrix.part.id && format('-{0}', matrix.part.id) || '' }}
6969
path: |
7070
packages/**/__traces__/
7171
!**/node_modules/**
7272
if-no-files-found: ignore
7373
retention-days: 7
74+
75+
# The editor's Firefox suite is split into Vitest shards next to one job
76+
# for every other package. The rulesets on `main` and `next` require the
77+
# check name `Browser tests (firefox)`, so `firefox` reports the combined
78+
# result under that name and fails unless every part succeeded.
79+
firefox-part:
80+
timeout-minutes: 60
81+
name: Browser tests (firefox, ${{ matrix.part.id }})
82+
runs-on: ${{ matrix.os }}
83+
container:
84+
image: mcr.microsoft.com/playwright:v1.62.1-noble
85+
options: --user 1001
86+
env:
87+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
88+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
89+
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
os: [ubuntu-latest]
94+
browser: [firefox]
95+
node: [lts/*]
96+
part:
97+
- id: editor-1
98+
turbo: --filter=@portabletext/editor
99+
vitest: --shard=1/2
100+
- id: editor-2
101+
turbo: --filter=@portabletext/editor
102+
vitest: --shard=2/2
103+
- id: others
104+
turbo: --filter=!@portabletext/editor
105+
106+
steps: *steps
107+
108+
firefox:
109+
name: Browser tests (firefox)
110+
needs: firefox-part
111+
if: always()
112+
runs-on: ubuntu-latest
113+
timeout-minutes: 5
114+
steps:
115+
- name: Require every Firefox part to pass
116+
run: test "${{ needs.firefox-part.result }}" = success

0 commit comments

Comments
 (0)