Skip to content

⚡️(ci) speed up the e2e job - #386

Merged
NathanVss merged 5 commits into
mainfrom
ci/speed-up-e2e
Nov 19, 2026
Merged

NathanVss merged 5 commits into
mainfrom
ci/speed-up-e2e

Conversation

@NathanVss

@NathanVss NathanVss commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The e2e job took about 10 minutes, 9 of them running the 1,000+ component tests on only 2 workers, one browser after the other.

What

  1. Skip the ui-components build before the component tests. Playwright compiles src itself; only the ui-tokens build is still needed. Saves about 30 s.
  2. Run the tests on 4 workers instead of 2: Playwright uses half the CPUs on CI by default, and the GitHub runners have 4 vCPUs.
  3. One e2e job per browser, in parallel. Only three jobs: runners come from a pool shared by the whole organization, so more jobs could wait for a free runner and repeat the setup. Turbo is called directly because yarn 1 drops the -- that passes --project to Playwright.
  4. Wait longer for the scanned PDF page. Its canvas stays hidden until pdfjs decodes three large JPEG 2000 layers; with 4 Chromium workers on the runner, that took more than the 10 s the test allowed (it failed twice in a row). The rest of the test already allowed for the slow decode.

Results (measured on this PR)

e2e duration (longest job) Tests
main before 10 min 10 s (one job) 9.0 min on 2 workers
1 + 2 5 min 58 s (one job) 5.3 min on 4 workers
1 + 2 + 3 + 4 4 min 22 s (Firefox, incl. 38 s waiting for a runner) Chromium 1.4 min, WebKit 2.5 min, Firefox 3.2 min

The whole workflow now takes about 4 min 40 s. Firefox is the slowest browser and sets the total; splitting it in 2 shards would gain about 1.5 min more, at the cost of a fourth job that may queue.

The check names change from e2e to e2e (chromium), e2e (firefox) and e2e (webkit). They aren't required checks (only test and build are), so nothing needs to change in the rules. On failure, each browser uploads its own report (playwright-report-<browser>).

🤖 Generated with Claude Code

Playwright compiles the components from src with Vite, so the e2e job
doesn't need the ui-components dist. Building it took about 40 s of each
run. The tests still need the ui-tokens build, which the theme imports.
On CI, Playwright uses half the CPUs by default: 2 workers on the 4 vCPU
GitHub runners, so the 1,000+ tests took 9 minutes. They mostly wait on
the browsers, so one worker per vCPU should run them much faster on the
same runner, without waiting for more runners from the shared pool.
The three browsers ran one after the other on the same runner. A job per
browser runs them at the same time. We stop at three jobs: the runners
come from a pool shared by the whole organization, and every extra job
may wait for a free runner and repeat the setup. The job name also tells
which browser failed, and a rerun only runs that browser again.
The canvas of the scanned page stays hidden until pdfjs has decoded its
three JPEG 2000 layers. With 4 workers sharing the CI runner, that takes
more than the 10 s the test gave it, so it failed every time in Chromium.
The rest of the test already allowed for the slow decode.
@NathanVss
NathanVss marked this pull request as ready for review November 19, 2026 10:21

@jbpenrath jbpenrath left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By reviewing this PR, I think about another ci checks that could be useful. Surely to do in a dedicated PR.

  build:
    # ...
      - name: Build
        run: yarn build
      - name: Upload generated tokens
        uses: actions/upload-artifact@v4
        with:
          name: generated-tokens
          path: |
            packages/ui-components/src/cunningham-tokens*
            packages/ui-tokens/src/lib/cunningham-tokens.ts

  check-tokens:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
      - name: Download generated tokens
        uses: actions/download-artifact@v4
        with:
          name: generated-tokens
          path: packages
      - name: Check committed tokens are up to date
        run: |
          git diff --exit-code -- packages \
            || { echo "::error::Cunningham tokens are out of date, run 'yarn build' and commit them."; exit 1; }

With 4 workers, the runner's CPU is busy, and a test that waits on a slow
render may now and then run out of time, like the scanned PDF did. One
retry keeps such a test from failing the whole job, while the report still
lists it as flaky so we can see it and fix its timing.
@NathanVss
NathanVss merged commit b091789 into main Nov 19, 2026
18 checks passed

This branch was successfully deployed

1 active deployment
github-pages — b0917896 Deployed Nov 19, 2026 by NathanVss via deploy-storybook #1232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants