Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 63 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ concurrency:

jobs:
playwright:
name: Playwright + axe
name: Playwright + axe (shard ${{ matrix.shard }}/${{ strategy.job-total }})
runs-on: ubuntu-24.04
# Three shards, each with its own dev stack and its own
# `sourcebans_e2e`, so `workers: 1` (one shared DB per stack) no
# longer sets the total time (#115). Playwright cuts the suite into
# contiguous slices by test count; from the per-test durations of
# the PR #114 run (428 s of tests on 29/11/2026), three slices carry
# 158 / 132 / 138 s, while four would leave one at 175 s. Every
# shard runs to the end (no fail-fast) so a red run lists every
# failing spec, like the single job did. The shard count is the
# length of the list: a fork with a single self-hosted runner, where
# shards would only queue one after the other, can set `[1]`.
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
# Generous overall timeout: first-run includes a full chromium
# download + apt-install. Subsequent runs come back inside this
# cap easily. Persistent failures (no retries left) still fail the
Expand Down Expand Up @@ -62,40 +76,80 @@ jobs:

# Run the suite. `./sbpp.sh e2e` exec's into the web container
# and lazily installs @playwright/test + chromium + system deps
# on first run; CI pays this cost once per workflow because
# nothing is cached between runs (the install footprint is small
# enough that caching is more effort than it saves).
# on first run; CI pays this cost once per shard (about 26 s on
# the PR #114 run) because nothing is cached between runs.
#
# Retries are wired in `playwright.config.ts` via
# `retries: process.env.CI ? 1 : 0` — one retry on flake, fail
# the job on persistent failure.
#
# `blob` feeds the merged HTML report below; `list` keeps the
# per-test lines in the job log.
- name: Run E2E
env:
CI: '1'
run: ./sbpp.sh e2e
run: ./sbpp.sh e2e --shard=${{ matrix.shard }}/${{ strategy.job-total }} --reporter=blob,list

# Upload artifacts on failure so reviewers can debug from the
# PR UI without re-running locally. The HTML report and the
# raw test-results (traces, videos, axe report attachments)
# together cover almost every "what failed and why" question.
- name: Upload Playwright report
- name: Upload blob report
if: failure()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: web/tests/e2e/playwright-report/
name: blob-report-${{ matrix.shard }}
path: web/tests/e2e/blob-report/
retention-days: 7
if-no-files-found: ignore

- name: Upload Playwright test-results
if: failure()
uses: actions/upload-artifact@v7
with:
name: playwright-test-results
name: playwright-test-results-${{ matrix.shard }}
path: web/tests/e2e/test-results/
retention-days: 7
if-no-files-found: ignore

- name: Tear down
if: always()
run: ./sbpp.sh down

# Only after a failure: merge the shards' blob reports into the one
# HTML report reviewers download from the PR, as before the split.
report:
name: Playwright report
needs: playwright
if: failure()
runs-on: ubuntu-24.04
defaults:
run:
working-directory: web/tests/e2e
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 22

- name: Install Playwright
run: npm ci --no-audit --no-fund

- name: Download blob reports
uses: actions/download-artifact@v8
with:
pattern: blob-report-*
path: web/tests/e2e/all-blob-reports
merge-multiple: true

- name: Merge into an HTML report
run: npx playwright merge-reports --reporter html ./all-blob-reports

- name: Upload Playwright report
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: web/tests/e2e/playwright-report/
retention-days: 7
if-no-files-found: ignore
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ Playwright E2E specifics:
`forbidden / No access`, etc.). Until each worker has its own DB,
parallelism here is unsound. Don't bump `workers` back up without
shipping per-worker DB isolation.
- CI parallelism comes from **sharding** instead: `e2e.yml` runs the
suite as three jobs (`--shard=N/3`), each with its own dev stack and
its own `sourcebans_e2e`. Playwright cuts contiguous slices by test
count, so a spec that suddenly gets much slower can unbalance them;
re-check the shard durations when one job runs far longer than the
others. On failure, a `report` job merges the shards' blob reports
into the usual `playwright-report` artifact; traces are in
`playwright-test-results-N` (#115).
- Flake tolerance is **off**: `retries: 1` in CI **plus**
`failOnFlakyTests: true`. A spec that fails first try and passes on
retry counts as a real failure — the retry exists so
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Legend:
? = Other stuff
```

(29/11/26): Version 2.2.30-srcdslab
-----------------------
```
01. ? ci: the Playwright E2E suite runs as three shards in parallel,
each with its own dev stack and database; a failed run still
publishes one merged HTML report (#115)
```

(29/11/26): Version 2.2.29-srcdslab
-----------------------
```
Expand Down