Recipe
Lighthouse CI
Automate performance, accessibility, and SEO audits in your CI pipeline so every deploy ships with measurable quality gates.
Overview
Lighthouse CI runs Google Lighthouse against your production or preview URLs on every commit. It asserts budgets for performance, accessibility, best-practices, and SEO scores — blocking merges when thresholds are breached.
Quick Start
npm install -g @lhci/cli
lhci wizardThe wizard generates .lighthouserc.json with sensible defaults for your project.
Configuration
{
"ci": {
"collect": {
"url": ["http://localhost:3000"],
"numberOfRuns": 3
},
"assert": {
"preset": "lighthouse:recommended",
"assertions": {
"categories:performance": ["error", {"minScore": 0.9}],
"categories:accessibility": ["error", {"minScore": 0.95}]
}
},
"upload": {
"target": "temporary-public-storage"
}
}
}GitHub Actions
- name: Lighthouse CI
run: |
npm install -g @lhci/cli
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_TOKEN }}Score Budgets
- Performance ≥ 90 — blocks regressions below threshold
- Accessibility ≥ 95 — enforces inclusive design
- Best Practices ≥ 90 — catches deprecated APIs
- SEO ≥ 90 — validates meta tags and crawlability
Diff Viewer
Lighthouse CI uploads HTML reports to temporary public storage. The GitHub status check links directly to a diff view comparing the current run against the base branch, highlighting regressions in red and improvements in green.
Next: integrate with Vercel preview deployments for per-PR audits.
Vercel Preview Recipe →