From 02f79f22760dc0202801c9bf10cafc9f9c2f646e Mon Sep 17 00:00:00 2001 From: Zachary Miller Date: Sun, 8 Nov 2026 17:21:28 -0500 Subject: [PATCH] Run the browser tests in parallel, one job per engine The browser tests ran every engine one after the other in a single job, so the job got slower with every test added, toward its 10-minute limit. - Each engine now runs in its own job, in parallel, installing only its browser. Tests within a job still run one at a time. - A final job named browser-tests passes only if every engine passed, so the required checks stay the same when engines change. - The minified build, which sites load, runs in every engine; the source, which differs only by minification, runs in Chromium. --- .github/workflows/checks.yml | 27 +++++++++++++++++++++++---- playwright.config.mjs | 10 ++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8be93fc..7e702ac 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -31,9 +31,15 @@ jobs: - name: List package contents run: npm pack --dry-run - browser-tests: + # One job per engine, in parallel. + browser-engines: + name: browser-tests (${{ matrix.browser }}) runs-on: ubuntu-26.04 timeout-minutes: 10 + strategy: + fail-fast: false # report every engine + matrix: + browser: [chromium, firefox, webkit] steps: - uses: actions/checkout@v7.0.1 with: @@ -46,7 +52,20 @@ jobs: - run: npm ci # Not cached: Playwright's docs say restoring takes about as long as downloading. - - name: Install browsers - run: npx playwright install --with-deps --only-shell chromium firefox webkit + - name: Install the browser + run: npx playwright install --with-deps --only-shell ${{ matrix.browser }} + + - run: npm run test:browsers -- --project="${{ matrix.browser }} *" - - run: npm run test:browsers + # The required check: passes only if every engine passed, so the required + # checks stay the same when engines change. + browser-tests: + needs: browser-engines + if: always() + runs-on: ubuntu-26.04 + timeout-minutes: 1 + steps: + - name: Check that every engine passed + env: + RESULT: ${{ needs.browser-engines.result }} + run: test "$RESULT" = success diff --git a/playwright.config.mjs b/playwright.config.mjs index d65ce5a..6536c5e 100644 --- a/playwright.config.mjs +++ b/playwright.config.mjs @@ -3,12 +3,14 @@ import { defineConfig, devices } from '@playwright/test'; const CI = Boolean(process.env.CI); -// CI runs every engine; locally only Chromium (npx playwright install --only-shell chromium). +// CI runs every engine (one job each, picked with --project); locally only Chromium +// (npx playwright install --only-shell chromium). const browsers = CI ? ['chromium', 'firefox', 'webkit'] : ['chromium']; const devicesByBrowser = { chromium: 'Desktop Chrome', firefox: 'Desktop Firefox', webkit: 'Desktop Safari' }; -// Every test runs against both the source and the minified build. -const files = ['pace.js', 'pace.min.js']; +// The minified build, which sites load, runs in every engine; the source, which differs only +// by minification, in Chromium. +const filesByBrowser = { chromium: ['pace.js', 'pace.min.js'], firefox: ['pace.min.js'], webkit: ['pace.min.js'] }; export default defineConfig({ testDir: 'tests', @@ -16,7 +18,7 @@ export default defineConfig({ workers: CI ? 1 : undefined, reporter: CI ? [['github'], ['list']] : 'list', projects: browsers.flatMap((browser) => - files.map((paceFile) => ({ + filesByBrowser[browser].map((paceFile) => ({ name: `${browser} ${paceFile}`, use: { ...devices[devicesByBrowser[browser]], paceFile }, })),