Skip to content

Commit b210c9a

Browse files
raifdmuellerclaude
andcommitted
ci: add Lighthouse CI with performance/a11y/SEO budgets
Lighthouse CI runs on every PR against main. Budgets (category-level scores, error-blocking unless noted): Performance: >= 0.80 (baseline 0.89, desktop preset) Accessibility: >= 0.85 (baseline 0.89, color-contrast/labels flagged) Best Practices:>= 0.90 (baseline 1.00) SEO: >= 0.95 (baseline 1.00) Web Vitals as warnings (monitoring only, not blocking): LCP <= 2500ms, TBT <= 300ms, CLS <= 0.1 Setup: - @lhci/cli, http-server, wait-on as devDependencies - lighthouserc.json at repo root with desktop preset - .github/workflows/lighthouse.yml: build → serve → lhci autorun - Upload to temporary-public-storage (no LHCI server required) - .lighthouseci/ gitignored Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8947f7b commit b210c9a

5 files changed

Lines changed: 4427 additions & 143 deletions

File tree

.github/workflows/lighthouse.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
lhci:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22'
18+
cache: 'npm'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Build
24+
run: npm run build
25+
26+
- name: Start static server
27+
run: |
28+
npx http-server dist -p 5000 --silent &
29+
npx wait-on http://localhost:5000
30+
31+
- name: Run Lighthouse CI
32+
run: npx lhci autorun
33+
env:
34+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ Thumbs.db
1515
.vscode/
1616
*.swp
1717
*.swo
18+
19+
# Lighthouse CI local results
20+
.lighthouseci/

lighthouserc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"url": ["http://localhost:5000/"],
5+
"numberOfRuns": 3,
6+
"settings": {
7+
"preset": "desktop",
8+
"throttlingMethod": "simulate"
9+
}
10+
},
11+
"assert": {
12+
"assertions": {
13+
"categories:performance": ["error", { "minScore": 0.8 }],
14+
"categories:accessibility": ["error", { "minScore": 0.85 }],
15+
"categories:best-practices": ["error", { "minScore": 0.9 }],
16+
"categories:seo": ["error", { "minScore": 0.95 }],
17+
"largest-contentful-paint": ["warn", { "maxNumericValue": 2500 }],
18+
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
19+
"cumulative-layout-shift": ["warn", { "maxNumericValue": 0.1 }]
20+
}
21+
},
22+
"upload": {
23+
"target": "temporary-public-storage"
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)