diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 1786737b..481e1d34 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -6,10 +6,13 @@ name: E2E # # PR with label `e2e` -> `e2e`: chromium, the PR suites in one job # (`plain`: the lab app built with no Tailwind) -# nightly on main -> `e2e`: same job, skipped if main has not moved -# since the last green scheduled run; red opens an issue +# nightly on main -> `e2e`: same job, and `e2e-stress`: the stress suite +# on chromium in two shards, beside it. Both skipped if +# main has not moved since the last green scheduled +# run; a red one opens an issue # weekly + on demand -> `e2e-full`: every suite x chromium + webkit, with # stress. Run it before any release of adaptv. +# dispatch, `nightly` -> the nightly jobs, on the ref it was dispatched on # # No retries, in the configs or here (docs/guides/e2e.md §3.1). A re-run is a # human decision, recorded as attempt #2 on the run. `update.spec.ts` on @@ -23,6 +26,12 @@ on: - cron: "0 3 * * *" # nightly - cron: "0 4 * * 0" # weekly full matrix (Sunday) workflow_dispatch: + inputs: + scope: + description: "full: every suite x both engines. nightly: what the nightly runs." + type: choice + options: [full, nightly] + default: full permissions: contents: read @@ -46,7 +55,8 @@ jobs: e2e: if: >- (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'e2e')) || - (github.event_name == 'schedule' && github.event.schedule == '0 3 * * *') + (github.event_name == 'schedule' && github.event.schedule == '0 3 * * *') || + (github.event_name == 'workflow_dispatch' && inputs.scope == 'nightly') runs-on: ubuntu-latest timeout-minutes: 40 permissions: @@ -127,10 +137,89 @@ jobs: --title "nightly e2e failed on ${GITHUB_SHA:0:7}" \ --body "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}. Fix forward on a PR." + # The stress suite every night, so a stress regression is seen the next morning + # rather than on Sunday. Chromium only: webkit stays in the weekly `e2e-full`. + # One worker per config, ~30 min in one job; two shards of ~15 min run beside + # `e2e`, so the nightly takes no longer than it did. + e2e-stress: + name: e2e-stress (chromium, ${{ matrix.shard }}/2) + if: >- + (github.event_name == 'schedule' && github.event.schedule == '0 3 * * *') || + (github.event_name == 'workflow_dispatch' && inputs.scope == 'nightly') + runs-on: ubuntu-latest + timeout-minutes: 35 + permissions: + contents: read + actions: read + issues: write + strategy: + fail-fast: false + matrix: + shard: [1, 2] + steps: + - name: Skip if main has not moved + id: moved + if: github.event_name == 'schedule' + env: + GH_TOKEN: ${{ github.token }} + run: | + last="$(gh run list -R "$GITHUB_REPOSITORY" --workflow e2e.yml --event schedule --branch main --status success -L 1 --json headSha --jq '.[0].headSha' 2>/dev/null || true)" + if [ "$last" = "$GITHUB_SHA" ]; then + echo "run=false" >> "$GITHUB_OUTPUT" + echo "main is at ${GITHUB_SHA:0:7}, already green in a scheduled run: skipped." >> "$GITHUB_STEP_SUMMARY" + else + echo "run=true" >> "$GITHUB_OUTPUT" + fi + + - name: Checkout + if: steps.moved.outputs.run != 'false' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Setup + if: steps.moved.outputs.run != 'false' + uses: ./.github/actions/setup + + - name: Install (playground) + if: steps.moved.outputs.run != 'false' + run: pnpm playground:setup + + - name: Browser cache + if: steps.moved.outputs.run != 'false' + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-chromium-${{ hashFiles('playground/pnpm-lock.yaml') }} + + - name: Browser (chromium) + if: steps.moved.outputs.run != 'false' + run: pnpm --dir playground exec playwright install --with-deps chromium + + - name: Test (playwright, stress, chromium, ${{ matrix.shard }}/2) + id: e2e + if: steps.moved.outputs.run != 'false' + run: pnpm --dir playground test:e2e:stress --project=chromium --shard=${{ matrix.shard }}/2 + + - name: Playwright report + if: failure() && steps.e2e.outcome == 'failure' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: playwright-report-stress-chromium-${{ matrix.shard }} + path: playground/playwright-report/ + retention-days: 14 + + - name: Open an issue for a red nightly + if: failure() && github.event_name == 'schedule' + env: + GH_TOKEN: ${{ github.token }} + run: | + gh issue create -R "$GITHUB_REPOSITORY" \ + --title "nightly e2e stress (shard ${{ matrix.shard }}/2) failed on ${GITHUB_SHA:0:7}" \ + --body "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}. Fix forward on a PR." + e2e-full: name: e2e-full (${{ matrix.suite }}, ${{ matrix.engine }}) if: >- - github.event_name == 'workflow_dispatch' || + (github.event_name == 'workflow_dispatch' && inputs.scope != 'nightly') || (github.event_name == 'schedule' && github.event.schedule == '0 4 * * 0') runs-on: ubuntu-latest # A backstop, not a budget: every spec is capped by its own test timeout. diff --git a/CLAUDE.md b/CLAUDE.md index b73d1708..1866a57d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -48,7 +48,7 @@ to a ready PR only what you want merged. Browser suites in CI (`e2e.yml`, never required): the `e2e` label on a PR runs the five PR suites (`test:e2e`, `:plain`, `:sw`, `:sw:spa`, `:sw:prompt`) on chromium, and the same runs nightly on -`main`; `e2e-full` (every suite × chromium + webkit, weekly or on demand) runs before a release. The +`main` with `:stress` on chromium beside it (dispatch with `scope=nightly` to run that set on a branch); `e2e-full` (every suite × chromium + webkit, weekly or on demand) runs before a release. The WebKit and Android smokes run on demand or when their own files change. Before marking ready a PR that touches runtime or service-worker code (or anything visual or behavioural), run the specs you touched locally on chromium and paste the result in the PR's `Verify:` section, or add the `e2e` label. diff --git a/docs/guides/e2e.md b/docs/guides/e2e.md index 117bb47f..bc3cea38 100644 --- a/docs/guides/e2e.md +++ b/docs/guides/e2e.md @@ -160,8 +160,8 @@ configs pin `workers: 1` for this, so do not pass `--workers` to them. **CI runs the browser suites off the per-PR path** (`.github/workflows/e2e.yml`, never a required check): a PR with the `e2e` label and the nightly run on `main` run five suites (main, `plain`, `sw`, -`sw-spa`, `sw-prompt`) on **chromium**; the weekly `e2e-full` runs every suite on chromium and -**webkit**. The HTML report and traces are uploaded when a suite fails. An unlabelled PR runs none of +`sw-spa`, `sw-prompt`) on **chromium**, and the nightly also runs `stress` on chromium in two shards; +the weekly `e2e-full` runs every suite on chromium and **webkit**. The HTML report and traces are uploaded when a suite fails. An unlabelled PR runs none of them, so run the specs you touched locally. The CI history is **O11a**, and whether the native matrix can run in CI at all is still open as **O11b** ([`../roadmap/open-questions.md`](../roadmap/open-questions.md)). diff --git a/docs/guides/testing.md b/docs/guides/testing.md index f34988b7..f952252f 100644 --- a/docs/guides/testing.md +++ b/docs/guides/testing.md @@ -121,7 +121,7 @@ required check on `main`. Draft PRs run only the affected tests; docs-only PRs r **The browser suites run off the per-push path** (`.github/workflows/e2e.yml`): add the label `e2e` to a PR to run the chromium PR suites (main, sw, sw-spa, sw-prompt) in one job; a nightly run does the -same on `main` when it has moved, and opens an issue when red; a weekly run (and a manual dispatch) +same on `main` when it has moved, plus `stress` on chromium, and opens an issue when red; a weekly run (and a manual dispatch) runs every suite on chromium **and** webkit, including `stress`. Run the full matrix before a release. Whether the native matrix can run in CI at all is still open (**O11b**). diff --git a/docs/roadmap/open-questions.md b/docs/roadmap/open-questions.md index b18c76aa..77eacb17 100644 --- a/docs/roadmap/open-questions.md +++ b/docs/roadmap/open-questions.md @@ -14,8 +14,9 @@ ### O11a — Browser suite in CI **Answered: every suite, both engines, off the per-PR path.** `.github/workflows/e2e.yml` (never a -required check) has two jobs. `e2e` runs five suites (main, `plain`, `sw`, `sw-spa`, `sw-prompt`) on -`chromium` for a PR labelled `e2e` and nightly on `main`. `e2e-full` is a matrix of every suite +required check) has three jobs. `e2e` runs five suites (main, `plain`, `sw`, `sw-spa`, `sw-prompt`) on +`chromium` for a PR labelled `e2e` and nightly on `main`; `e2e-stress` runs `stress` on `chromium`, in +two shards, nightly beside it. `e2e-full` is a matrix of every suite (main, `plain`, `stress`, `sw`, `sw-spa`, `sw-prompt`, `sw-node`, `sw-subpath`) × `chromium` and `webkit`, weekly and on demand, and runs before a release. Each job installs only its own engine, runs with `CI=1` so the config boots and never reuses its own server, and uploads the HTML report