From 508e11368c96de7fcc23c6e4e06c8b5f9d6eb430 Mon Sep 17 00:00:00 2001 From: Diego Diaz Date: Thu, 29 Oct 2026 23:34:17 -0500 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=91=B7=20run=20Playwright=20only=20?= =?UTF-8?q?when=20the=20library=20or=20the=20test=20app=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Playwright suite drives the library (src/) through the test app (test/), but it ran on every push and pull request, so website-only changes waited minutes for it. It moves to e2e.yml, which only runs when src/, test/, their build and Playwright config, the dependencies or the CI setup change. The release calls it explicitly, so nothing ships without it. --- .github/workflows/ci.yml | 50 +------------------ .github/workflows/e2e.yml | 92 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 8 ++- AGENTS.md | 7 ++- CONTRIBUTING.md | 2 +- 5 files changed, 107 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60b8145..63e9bab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ on: pull_request: workflow_call: # lets release.yml reuse this exact gate +# Playwright runs in e2e.yml, only when the library or the test app change. + concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} # cancel superseded PR runs, but never cancel pushes to main or v2 @@ -43,51 +45,3 @@ jobs: - name: Typecheck test app run: pnpm build.types && pnpm lint working-directory: test - - e2e: - name: Playwright (${{ matrix.browser }}) - needs: verify - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - browser: [chromium, webkit] - steps: - - uses: actions/checkout@v7 - - uses: ./.github/actions/setup - - # The Playwright webServer runs `pnpm dev` in ./test, which imports the - # workspace-linked library from lib/, so the lib must be built first. - - name: Build library - run: pnpm build.types && pnpm build.lib - - - name: Resolve Playwright version - id: pw - run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT" - - - name: Cache Playwright browsers - id: pw-cache - uses: actions/cache@v6 - with: - path: ~/.cache/ms-playwright - key: playwright-v2-${{ runner.os }}-${{ matrix.browser }}-${{ steps.pw.outputs.version }} - - - name: Install Playwright (browser + system deps) - if: steps.pw-cache.outputs.cache-hit != 'true' - run: pnpm exec playwright install --with-deps ${{ matrix.browser }} - - - name: Install Playwright system deps (cached browser) - if: steps.pw-cache.outputs.cache-hit == 'true' - run: pnpm exec playwright install-deps ${{ matrix.browser }} - - - name: Run Playwright tests - run: pnpm exec playwright test --project=${{ matrix.browser }} - - - name: Upload report - if: ${{ !cancelled() }} - uses: actions/upload-artifact@v7 - with: - name: playwright-report-${{ matrix.browser }} - path: playwright-report/ - retention-days: 7 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..9806b89 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,92 @@ +name: E2E + +# The Playwright suite drives the library (src/) through the test app (test/), +# so it only runs when one of them, or what builds and runs them, changes: a +# pull request that only touches the website or the docs doesn't wait for it. +# The release always runs it (workflow_call). +on: + push: + branches: [main, v2] + paths: + - "src/**" + - "test/**" + - "playwright.config.ts" + - "vite.config.ts" + - "tsconfig.json" + - "tsconfig.lib.json" + - "package.json" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - ".github/actions/setup/**" + - ".github/workflows/e2e.yml" + # Every base, not only main: in a stack each pull request targets the branch below it. + pull_request: + paths: + - "src/**" + - "test/**" + - "playwright.config.ts" + - "vite.config.ts" + - "tsconfig.json" + - "tsconfig.lib.json" + - "package.json" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - ".github/actions/setup/**" + - ".github/workflows/e2e.yml" + workflow_call: # lets release.yml run it before publishing + +concurrency: + group: e2e-${{ github.workflow }}-${{ github.ref }} + # cancel superseded PR runs, but never cancel pushes to main or v2 + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + +jobs: + e2e: + name: Playwright (${{ matrix.browser }}) + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + browser: [chromium, webkit] + steps: + - uses: actions/checkout@v7 + - uses: ./.github/actions/setup + + # The Playwright webServer runs `pnpm dev` in ./test, which imports the + # workspace-linked library from lib/, so the lib must be built first. + - name: Build library + run: pnpm build.types && pnpm build.lib + + - name: Resolve Playwright version + id: pw + run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT" + + - name: Cache Playwright browsers + id: pw-cache + uses: actions/cache@v6 + with: + path: ~/.cache/ms-playwright + key: playwright-v2-${{ runner.os }}-${{ matrix.browser }}-${{ steps.pw.outputs.version }} + + - name: Install Playwright (browser + system deps) + if: steps.pw-cache.outputs.cache-hit != 'true' + run: pnpm exec playwright install --with-deps ${{ matrix.browser }} + + - name: Install Playwright system deps (cached browser) + if: steps.pw-cache.outputs.cache-hit == 'true' + run: pnpm exec playwright install-deps ${{ matrix.browser }} + + - name: Run Playwright tests + run: pnpm exec playwright test --project=${{ matrix.browser }} + + - name: Upload report + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v7 + with: + name: playwright-report-${{ matrix.browser }} + path: playwright-report/ + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bdb640..669a952 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,14 @@ permissions: contents: read jobs: - # Full quality gate (lint + typecheck + lib build + Playwright) before anything ships. + # Full quality gate before anything ships: lint, typecheck and builds (ci.yml) + # and the Playwright suite (e2e.yml), whatever the release changed. ci: uses: ./.github/workflows/ci.yml + e2e: + uses: ./.github/workflows/e2e.yml + # Runs next to the CI, so a mistagged release fails in seconds. version: name: The tag is the version @@ -33,7 +37,7 @@ jobs: stage: name: Stage on npm - needs: [ci, version] + needs: [ci, e2e, version] runs-on: ubuntu-latest permissions: contents: read diff --git a/AGENTS.md b/AGENTS.md index 3ac1f39..98864a7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,7 +94,7 @@ at build time too (`website/src/lib/github.ts`). Details: `website/README.md`. ## Releases -A `v*` tag (pushed by `pnpm release`) runs `.github/workflows/release.yml`: CI → tag/version check → +A `v*` tag (pushed by `pnpm release`) runs `.github/workflows/release.yml`: CI + e2e → tag/version check → pack + contents check → `npm stage publish` (Trusted Publishing) → draft GitHub release (changelogithub) → waits until a maintainer runs `pnpm stage approve` (2FA) → publishes the release → deploys the website. Steps: `CONTRIBUTING.md` → Releases. @@ -139,6 +139,11 @@ pnpm test # playwright (from root) After any change to `src/`, the minimum green bar is: **`pnpm build.types` + `pnpm build.lib`** pass at the root, and `pnpm build.types` passes in `website/` and `test/`. +In GitHub Actions, `ci.yml` (lint, types, the library and website builds) runs on every push to +`main`/`v2` and every pull request; `e2e.yml` (Playwright, chromium + webkit) only when `src/`, +`test/`, the Playwright/Vite/TS config, the dependencies or the CI setup change. The release runs +both whatever changed. + ## Qwik authoring conventions (apply to all `.tsx` here) - Components are declared with `component$(() => { ... })`. Event handlers and inline closures that diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3d5495..b7c5cdf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,7 +64,7 @@ Maintainers only. On an up-to-date `v2` (`main` once `v2` merges), `pnpm release version (`2.0.0-beta.2`…), commits it, tags it and pushes. The tag runs [`release.yml`](./.github/workflows/release.yml): -1. the CI, and a check that the tag matches the version in `package.json`; +1. the CI, the Playwright suite and a check that the tag matches the version in `package.json`; 2. it builds and packs the library, checks the package contents and **stages** it on npm through Trusted Publishing (a prerelease under its identifier, like `beta`; a plain version under `latest`);