Skip to content

Commit bc78cbd

Browse files
VijitSingh97claude
andcommitted
ci: Lighthouse CI budgets on PRs (closes #13)
A public single-page showcase site with no perf / a11y / SEO checks — oversized images, broken meta/OG tags, contrast issues, or render-blocking assets could ship silently. - lighthouse.yml: on every PR, build the site and run Lighthouse CI over the static public/ (Hugo built with baseURL "/" so the root-relative, fully self-contained output serves locally). Reports stored as a GitHub artifact — no third-party upload, in keeping with the site's zero-third-party ethos. - lighthouserc.json: category assertions for performance (0.90), accessibility (0.95), SEO (0.95), best-practices (0.95) — set to "warn" to start so the first runs record a baseline; ratchet to hard "error" floors once known. Verified locally: production build is root-relative and self-contained (LHCI-servable); prettier/JSON/YAML/zizmor clean. The Lighthouse job runs on this PR, so its scores are the recorded baseline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0c15f6e commit bc78cbd

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/lighthouse.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lighthouse
2+
3+
# Performance / accessibility / SEO / best-practices budgets on the built site, on every PR.
4+
# Assertions start as WARNINGS (non-blocking) so we can record a baseline; ratchet them to hard
5+
# 'error' floors in lighthouserc.json once the numbers are known (#13).
6+
7+
on:
8+
pull_request:
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lighthouse:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
20+
with:
21+
persist-credentials: false # zizmor: artipacked
22+
- name: Install Hugo (extended)
23+
run: |
24+
HUGO_VERSION="$(cat .hugoversion 2>/dev/null || echo 0.162.1)" # tracks .hugoversion once #15 lands
25+
wget -O "${{ runner.temp }}/hugo.deb" \
26+
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb"
27+
sudo dpkg -i "${{ runner.temp }}/hugo.deb"
28+
- name: Build site
29+
env:
30+
HUGO_ENVIRONMENT: production
31+
TZ: UTC
32+
run: hugo --gc --minify --baseURL "/"
33+
- name: Lighthouse CI
34+
uses: treosh/lighthouse-ci-action@3e7e23fb74242897f95c0ba9cabad3d0227b9b18 # v12.6.2
35+
with:
36+
configPath: ./lighthouserc.json
37+
uploadArtifacts: true # store HTML reports as a GitHub artifact (no third-party upload)
38+
temporaryPublicStorage: false

lighthouserc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./public",
5+
"numberOfRuns": 3
6+
},
7+
"assert": {
8+
"//": "Warnings to start (#13): record a baseline from the first runs, then ratchet these to 'error' floors just under it so regressions fail.",
9+
"assertions": {
10+
"categories:performance": ["warn", { "minScore": 0.9 }],
11+
"categories:accessibility": ["warn", { "minScore": 0.95 }],
12+
"categories:seo": ["warn", { "minScore": 0.95 }],
13+
"categories:best-practices": ["warn", { "minScore": 0.95 }]
14+
}
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)