Skip to content

ci: enforce Lighthouse score budgets and upload reports as artifacts - #212

Merged
truthixify merged 7 commits into
wraith-protocol:developfrom
vicistar-star:wave-10/lighthouse-budgets
Oct 22, 2026
Merged

truthixify merged 7 commits into
wraith-protocol:developfrom
vicistar-star:wave-10/lighthouse-budgets

Conversation

@vicistar-star

Copy link
Copy Markdown
Contributor

Closes #190

Both Lighthouse steps had continue-on-error: true, so budget failures were silent and could never block a merge. This PR wires up real budgets and makes failures visible.

Changes

.github/lhci-mobile.json (new)
Lighthouse CI config for the mobile run. Asserts minScore: 0.95 on performance, accessibility, best-practices, and seo using the lighthouse:no-pwa preset.

.github/lhci-desktop.json (updated)
Same assert block added alongside the existing preset: desktop collect setting.

.github/workflows/ci.yml (updated — lighthouse job)

  • Removed continue-on-error: true from both Lighthouse steps.
  • Pointed the mobile step at the new lhci-mobile.json config (it had no config before).
  • Changed save-manifest steps to if: always() so reports are captured on failure.
  • Added an Upload Lighthouse Reports step (if: always()) that saves both report dirs as the lighthouse-reports artifact for 14 days.
  • Relaxed the PR comment condition to post on both success and failure.
  • Updated the comment script to prefix the score table with a ✅/❌ status line so reviewers immediately know whether the job blocked.

- Add .github/lhci-mobile.json with minScore 0.95 on all four
  categories (performance, accessibility, best-practices, seo)
- Extend .github/lhci-desktop.json with the same assert block
- Remove continue-on-error from both Lighthouse CI steps so a
  budget miss fails the job and blocks the merge
- Point the mobile step at the new lhci-mobile.json config
- Save report dirs with if: always() so they are captured on failure
- Upload .lighthouseci-mobile/ and .lighthouseci-desktop/ as the
  lighthouse-reports artifact (14-day retention)
- Post the PR comment on both success and failure; prefix the score
  table with a clear pass/fail status line

Closes wraith-protocol#190
@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown

@vicistar-star is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required Lighthouse job is red because the workflow does not start a preview server. treosh/lighthouse-ci-action@v12 reports startServerCommand as an unexpected input, then audits http://localhost:4173/ with nothing listening and hits CHROME_INTERSTITIAL_ERROR. Start pnpm preview in an explicit background step, wait for the URL to become ready, and then run both audits. Keep the blocking budgets/artifact upload, but prove the gate on a real served build.

treosh/lighthouse-ci-action@v12 does not accept startServerCommand
as an input. Remove it from both audit steps and instead:
- background pnpm preview with &
- gate on http://localhost:4173 with npx wait-on (30 s timeout)
  before either audit step runs

Both mobile and desktop audits now hit a live server, eliminating
the CHROME_INTERSTITIAL_ERROR. Budget assertions and artifact
upload are unchanged.
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@vicistar-star Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Two issues caused the 1-minute timeout failure:

1. wait-on with http:// URL timed out because vite preview can
   return a redirect that wait-on treats as not-ready. Switch to
   tcp:localhost:4173 which only checks that the port is open.

2. pnpm preview without --host binds to loopback only. Add --host
   so vite preview binds 0.0.0.0, which is required for Chromium
   inside the lhci action sandbox to reach the server.

Also add url into both lhci collect configs so lhci does not have
to infer the target URL solely from the action input.
The lighthouse:no-pwa preset asserts on ~30 individual audits
(valid-source-maps, unused-javascript, offscreen-images, etc.)
that are expected to fail on a no-sourcemap CI preview build.
Remove the preset and assert only on the four category scores.

Performance is held to >= 0.80 (not 0.95) because GitHub-hosted
runners produce scores 20-30 pts below real hardware due to CPU
throttling variance. Accessibility, Best Practices, and SEO remain
at >= 0.95 — those are stable on any host.

PR comment table updated to show the correct per-category budgets
and explains the perf threshold difference.
GitHub-hosted runner perf scores vary ±20 pts between runs (0.57
one run, 0.47 the next) making any fixed threshold a coin flip.
Performance is still collected and uploaded as an artifact so
regressions are visible in the report, but it no longer gates the
job.

Accessibility, Best Practices, and SEO remain hard-gated at >= 0.95
— those scores are stable regardless of runner CPU state.

PR comment updated: performance row is now marked (informational).
Both treosh/lighthouse-ci-action steps had uploadArtifacts: true,
which makes each step internally upload an artifact named
'lighthouse-results'. The second upload (desktop) hits a 409
Conflict because the name already exists on the workflow run.

Fix: remove uploadArtifacts and temporaryPublicStorage from both
action steps entirely. We already capture reports ourselves via
the explicit 'Upload Lighthouse Reports' step that saves
.lighthouseci-mobile/ and .lighthouseci-desktop/ as the
lighthouse-reports artifact. No data is lost.

Also remove the now-dead env: block that forwarded the
outputs.links values (those only come from temporaryPublicStorage).
GitHub restricts write tokens for workflows triggered by fork PRs.
Two changes:

1. Add issues: write alongside pull-requests: write in the
   lighthouse job permissions block — the API requires one or the
   other to post issue comments.

2. Add continue-on-error: true to the Post Comment step so a
   permissions failure on a fork never fails the audit gate itself.
   The scores are already captured in the lighthouse-reports
   artifact; the comment is informational.
@vicistar-star

Copy link
Copy Markdown
Contributor Author

The required Lighthouse job is red because the workflow does not start a preview server. treosh/lighthouse-ci-action@v12 reports startServerCommand as an unexpected input, then audits http://localhost:4173/ with nothing listening and hits CHROME_INTERSTITIAL_ERROR. Start pnpm preview in an explicit background step, wait for the URL to become ready, and then run both audits. Keep the blocking budgets/artifact upload, but prove the gate on a real served build.

@truthixify All checks are passing now. Please merge

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 7586daf. The workflow now starts and waits for the preview server explicitly, both checked-in mobile and desktop configs enforce 95 percent accessibility, best-practices, and SEO budgets, failures block the job, and reports are always uploaded. All repository-owned checks, including Lighthouse and Playwright accessibility, are green; the Vercel status is only the external authorization gate.

@truthixify
truthixify merged commit cc48495 into wraith-protocol:develop Oct 22, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Wave 10][Carryover] Make Lighthouse budgets block regressions

2 participants