chore: nightly full e2e and size limit tests
This commit is contained in:
parent
b5b7008abf
commit
f320e845bb
5 changed files with 79 additions and 36 deletions
49
.github/workflows/nightly.yml
vendored
Normal file
49
.github/workflows/nightly.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Nightly E2E
|
||||||
|
|
||||||
|
# The full cross-browser e2e matrix (Chromium + Firefox + WebKit) is heavy to
|
||||||
|
# set up (browser downloads + system deps), so it runs once a day instead of on
|
||||||
|
# every push/PR. Push/PR CI keeps a fast Chromium-only e2e gate (test.yml).
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# 06:00 UTC daily
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
workflow_dispatch: # allow manual runs from the Actions tab
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e-all:
|
||||||
|
name: E2E (Chromium + Firefox + WebKit)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 11
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: pnpm
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
# Firefox/WebKit need system deps that `--with-deps` installs via apt.
|
||||||
|
- name: Install Playwright browsers
|
||||||
|
run: pnpm exec playwright install --with-deps chromium firefox webkit
|
||||||
|
- run: pnpm test:e2e:all
|
||||||
|
|
||||||
|
size:
|
||||||
|
name: Size limit
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 11
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: pnpm
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
# `pnpm size-limit` builds `dist/` (tsc + esbuild) and checks each entry
|
||||||
|
# against the byte budgets declared in package.json `size-limit`.
|
||||||
|
- run: pnpm size-limit
|
||||||
31
.github/workflows/test.yml
vendored
31
.github/workflows/test.yml
vendored
|
|
@ -16,7 +16,7 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit:
|
unit:
|
||||||
name: Unit (happy-dom)
|
name: Unit
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
- run: pnpm test
|
- run: pnpm test
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
name: E2E (Chromium + Firefox + WebKit)
|
name: E2E
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
@ -43,25 +43,8 @@ jobs:
|
||||||
node-version-file: .nvmrc
|
node-version-file: .nvmrc
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
# Downloads the browser binaries and their OS libraries (Firefox/WebKit
|
# Chromium only on push/PR — the full Firefox/WebKit matrix runs nightly
|
||||||
# need system deps that `--with-deps` installs via apt on the runner).
|
# (.github/workflows/nightly.yml).
|
||||||
- name: Install Playwright browsers
|
- name: Install Playwright Chromium
|
||||||
run: pnpm exec playwright install --with-deps chromium firefox webkit
|
run: pnpm exec playwright install --with-deps chromium
|
||||||
- run: pnpm test:e2e:all
|
- run: pnpm test:e2e
|
||||||
|
|
||||||
size:
|
|
||||||
name: Size limit
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- uses: pnpm/action-setup@v4
|
|
||||||
with:
|
|
||||||
version: 11
|
|
||||||
- uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version-file: .nvmrc
|
|
||||||
cache: pnpm
|
|
||||||
- run: pnpm install --frozen-lockfile
|
|
||||||
# `pnpm size-limit` builds `dist/` (tsc + esbuild) and checks each entry
|
|
||||||
# against the byte budgets declared in package.json `size-limit`.
|
|
||||||
- run: pnpm size-limit
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
# Lean: lint + format staged files, then the fast unit suite.
|
# Everything runs at commit time. This repo auto-pushes to multiple remotes
|
||||||
# Heavier checks (browser e2e, size-limit) run on pre-push; the full
|
# (github, forgejo, sourcehut — see post-commit), so a pre-push hook would
|
||||||
# cross-browser matrix runs in CI.
|
# re-run these once per remote; keeping them here runs them once per commit.
|
||||||
|
# The full cross-browser e2e matrix still runs nightly in CI. Order: cheap → expensive.
|
||||||
pnpm exec lint-staged
|
pnpm exec lint-staged
|
||||||
pnpm test
|
pnpm test
|
||||||
|
pnpm test:e2e
|
||||||
|
pnpm size-limit
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# Heavier gate before code leaves the machine: browser e2e (Chromium only —
|
|
||||||
# Firefox/WebKit + their system deps are exercised in CI) and the size budget.
|
|
||||||
pnpm test:e2e
|
|
||||||
pnpm size-limit
|
|
||||||
|
|
@ -18,12 +18,24 @@ pnpm test:e2e:webkit # WebKit (the engine behind Safari)
|
||||||
pnpm test:e2e:all # Chromium + Firefox + WebKit
|
pnpm test:e2e:all # Chromium + Firefox + WebKit
|
||||||
|
|
||||||
pnpm test # fast unit suite (happy-dom), unchanged
|
pnpm test # fast unit suite (happy-dom), unchanged
|
||||||
pnpm test:all # unit + default e2e
|
pnpm test:all # unit + full e2e (all 3 engines)
|
||||||
```
|
```
|
||||||
|
|
||||||
`pnpm test:e2e` stays on Chromium so it works everywhere with minimal setup; use
|
`pnpm test:e2e` stays on Chromium so it works everywhere with minimal setup; use
|
||||||
`test:e2e:all` (or a CI matrix) for the full cross-browser run. Each script just
|
`test:e2e:all` for the full cross-browser run. Each script just sets the
|
||||||
sets the `E2E_BROWSERS` env var (comma-separated), which the config reads.
|
`E2E_BROWSERS` env var (comma-separated), which the config reads.
|
||||||
|
|
||||||
|
### Where each runs
|
||||||
|
|
||||||
|
| Stage | e2e scope |
|
||||||
|
| ----------------------------- | ----------------------------- |
|
||||||
|
| pre-commit | none (unit only) |
|
||||||
|
| pre-push | `test:e2e` (Chromium) |
|
||||||
|
| CI on push to `main` / PRs | `test:e2e` (Chromium) |
|
||||||
|
| CI nightly (`nightly.yml`) | `test:e2e:all` (all 3 engines) |
|
||||||
|
|
||||||
|
The full Firefox/WebKit matrix is heavy to provision, so it runs once a day
|
||||||
|
(and on-demand via **workflow_dispatch**) rather than on every push/PR.
|
||||||
|
|
||||||
Config lives in `vitest.e2e.config.mjs` (Vitest browser mode + the
|
Config lives in `vitest.e2e.config.mjs` (Vitest browser mode + the
|
||||||
`@vitest/browser-playwright` provider), kept separate from `vitest.config.mjs`
|
`@vitest/browser-playwright` provider), kept separate from `vitest.config.mjs`
|
||||||
|
|
@ -38,8 +50,8 @@ npx playwright install-deps # Linux only: system libraries
|
||||||
|
|
||||||
Firefox and especially WebKit need extra OS libraries on Linux (`libwoff1`,
|
Firefox and especially WebKit need extra OS libraries on Linux (`libwoff1`,
|
||||||
etc.); `playwright install-deps` requires root. Without them those engines fail
|
etc.); `playwright install-deps` requires root. Without them those engines fail
|
||||||
to launch — which is why the default target is Chromium and CI installs the deps
|
to launch — which is why the default target is Chromium, and only the nightly
|
||||||
before running `test:e2e:all`.
|
workflow installs the deps before running `test:e2e:all`.
|
||||||
|
|
||||||
## Coverage
|
## Coverage
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue