diff --git a/.github/NEW_PROJECT.md b/.github/NEW_PROJECT.md index aa3562e43..2b152c695 100644 --- a/.github/NEW_PROJECT.md +++ b/.github/NEW_PROJECT.md @@ -53,7 +53,7 @@ Logging: the website logs with [pino](https://getpino.io) (`apps/web/src/lib/ser | Project | Tests | Coverage and other bars | | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| website | Vitest projects in `apps/web/vite.config.ts` (server, client in browser mode, integration, build, Storybook); Playwright e2e | Vitest thresholds in `vite.config.ts`; Lighthouse budgets in `lighthouserc.cjs`; Storybook stories fail on a11y violations | +| website | Vitest projects in `apps/web/vite.config.ts` (server, client in browser mode, integration, build, Storybook); Playwright e2e | Vitest thresholds in `vite.config.ts`; Lighthouse budgets in `lighthouserc.cjs`, and every page in `lighthouse/pages.json` weekly against its history; Storybook stories fail on a11y violations | | localtoolbox | Vitest with jsdom; its README is its spec, checked by `test/docs.test.ts` | per-file thresholds in `vitest.config.ts`; Stryker mutation score of at least 91 (`stryker.config.mjs`) | | Rust | cargo-nextest (`.config/nextest.toml`); unit tests in each module's `tests.rs`; Hegel property tests; fuzz targets in `fuzz/` | `cargo coverage` (`.cargo/config.toml`) fails under its thresholds; `tools/hegel-coverage.sh` holds the Hegel tests alone to them | diff --git a/.github/labeler.yml b/.github/labeler.yml index b6fa3d055..a5c7e2123 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -272,6 +272,7 @@ tests: - "**/{vitest,vitest.stryker,playwright}.config.ts" - "**/stryker*.{mjs,ts}" - "apps/web/src/lib/server/testing/**" + - "apps/web/{lighthouse/**,scripts/lighthouse*.ts,scripts/lib/lighthouse.ts}" - "apps/locallibrary/bombadil/**" - "fuzz/**" - ".config/nextest.toml" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a60bd3370..cfaea9021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -256,8 +256,8 @@ jobs: # What the pages Lighthouse measures are built and served from: the app's code, static # files and Lua (HappyView answers the directory's queries), the dev network and seed # data it measures them on, its build and Lighthouse config, the dependencies, and the - # README and guides of the one tool page lighthouserc.cjs visits (add a tool here when - # its page goes in there). Left out: the app's tests and the helpers and fixture only + # README and guides of the one tool page lighthouse/pages.json marks `pr` (add a tool here + # when its page is marked). Left out: the app's tests and the helpers and fixture only # they import (src/lib/server/testing, the mix fixture), stories and Storybook docs, and # everything outside these paths (tests/, .storybook/, the lint and format configs, the # website's README, the Dockerfile). @@ -270,6 +270,7 @@ jobs: - 'apps/web/vite.config.ts' - 'apps/web/tsconfig.json' - 'apps/web/lighthouserc.cjs' + - 'apps/web/lighthouse/**' - 'apps/locallibrary/README.md' - 'apps/locallibrary/docs/*.md' - 'packages/tokens/**' diff --git a/.github/workflows/web-scheduled.yml b/.github/workflows/web-scheduled.yml index 5c98a2e10..bc5fdf401 100644 --- a/.github/workflows/web-scheduled.yml +++ b/.github/workflows/web-scheduled.yml @@ -1,9 +1,11 @@ name: Web scheduled # The end-to-end tests in every Playwright project (playwright.config.ts): Chromium, Firefox and -# WebKit on the desktop, and a Pixel 7 and an iPhone 14. Weekly and on demand (Actions > Web -# scheduled > Run workflow, on any branch), so pull requests only wait for web-ci.yml's Chromium run. -# A week that changed none of what they test skips them (see the changes job). +# WebKit on the desktop, and a Pixel 7 and an iPhone 14. Then Lighthouse on every page in +# lighthouse/pages.json, on a phone and a desktop, held against each page's history. Weekly and on +# demand (Actions > Web scheduled > Run workflow, on any branch), so pull requests only wait for +# web-ci.yml's Chromium run and its Lighthouse run on three pages. A week that changed none of what +# they test skips them (see the changes job). on: schedule: - cron: "29 4 * * 1" @@ -23,7 +25,7 @@ defaults: # Pinned the same way as web-ci.yml. jobs: - # Whether anything the end-to-end tests read changed since the last weekly or hand-started run on + # Whether anything the end-to-end tests and Lighthouse read changed since the last weekly or hand-started run on # main that passed. A run that failed doesn't count, so they run again each week until one # passes. Started by hand, everything runs, as it does when none of the workflow's last 100 runs # passed and there's nothing to compare with. The paths are what the e2e tests run: the app, the @@ -92,10 +94,127 @@ jobs: name: playwright-report path: apps/web/playwright-report/ + # Every page in lighthouse/pages.json, signed in where it needs to be (scripts/lighthouse.ts), one + # job per form factor. Each job's summary is its lighthouse-summary-