From bfacbffe9627654fd93d622ac78833d1e024a025 Mon Sep 17 00:00:00 2001 From: Tuan Phung Date: Sun, 11 Oct 2026 12:33:19 +0200 Subject: [PATCH] CI: run checks before the browser download and cache Playwright browsers --- .github/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 876f704..0fb6aea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,8 @@ jobs: test: runs-on: ubuntu-latest strategy: + # One failing React version should not cancel the other. + fail-fast: false matrix: react: [18, 19] steps: @@ -45,10 +47,20 @@ jobs: - run: npm ci - if: matrix.react != 19 run: npm install --no-save react@${{ matrix.react }} react-dom@${{ matrix.react }} @types/react@${{ matrix.react }} @types/react-dom@${{ matrix.react }} - # The tests run in Chromium, Firefox and WebKit. - - run: npx playwright install --with-deps chromium firefox webkit - # Formatting, lint and type checks. + # Formatting, lint and type checks first, so they fail before the browser download. - run: npm run check + # The tests run in Chromium, Firefox and WebKit. Browsers are cached per Playwright version. + - id: playwright + run: echo "version=$(node -p "require('playwright/package.json').version")" >> "$GITHUB_OUTPUT" + - id: playwright-cache + uses: actions/cache@v6 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }} + - if: steps.playwright-cache.outputs.cache-hit != 'true' + run: npx playwright install --with-deps chromium firefox webkit + - if: steps.playwright-cache.outputs.cache-hit == 'true' + run: npx playwright install-deps chromium firefox webkit - run: npm test - if: matrix.react == 19 run: npm run build