diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aee47df..cff229ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,6 +126,13 @@ jobs: CODING_SH_REQUIRE_DIST: "1" run: npm run check + # The Site workflow runs this on main and stops the deploy when a page is over budget. + # Running it here, on the same OS and Node as that workflow, fails the pull request instead. + - name: Site perf budget + if: matrix.shard == 1 && runner.os == 'Linux' && matrix.node == '24.x' + working-directory: apps/site + run: npm run perf:budget + # The built output holds nothing shaped like a secret. - name: Secret scan of the built output if: matrix.shard == 1 diff --git a/apps/site/scripts/perf-budget.mjs b/apps/site/scripts/perf-budget.mjs index 6a991768..408593ea 100644 --- a/apps/site/scripts/perf-budget.mjs +++ b/apps/site/scripts/perf-budget.mjs @@ -21,11 +21,12 @@ const BUDGET = { // troubleshooting, which gains an entry per failure a new feature can show // (27.8KB with the 0.1.6 entries). Raised from 26KB for those three. // Troubleshooting is 30.5KB after the docs rebuild of 2026-11-11, so 33KB. + // /docs/api/read is 30.3KB with the weight edit and checkpoint fields, so 33KB. htmlBrotli: { "/": 24.5 * KB, "/docs/cli/": 30 * KB, "/docs/api/": 30 * KB, - "/docs/api/read/": 30 * KB, + "/docs/api/read/": 33 * KB, "/docs/api/read/search/": 30 * KB, "/docs/troubleshooting/": 33 * KB, other: 26 * KB, diff --git a/docs/perf.md b/docs/perf.md index 86168b5d..95d32d37 100644 --- a/docs/perf.md +++ b/docs/perf.md @@ -125,7 +125,7 @@ page has its own blocking-time budget on the slow phone. The rules are in |---|---| | Pull requests | GitHub's hosted runners. Load-time budgets are skipped: they only hold on our own machine. | | Pushes to main | The one desk runner labelled `perf`, so two perf runs never overlap. CI and deploys run beside it. | -| Deploys | `npm run perf:budget` in apps/site checks page weight, inline CSS and script, fonts, scripts and images in the build. | +| Pull requests and deploys | `npm run perf:budget` in apps/site checks page weight, inline CSS and script, fonts, scripts and images in the build. CI runs it on every pull request, and the Site workflow runs it again before a deploy. | The desk runs other jobs, so each sample records `cpu_busy`, the share of CPU in use while the page loaded. A load-time budget counts only samples at 0.5 or less (`--quiet-cpu`). When fewer