Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lighthouse

# Performance / accessibility / SEO / best-practices budgets on the built site, on every PR.
# Assertions start as WARNINGS (non-blocking) so we can record a baseline; ratchet them to hard
# 'error' floors in lighthouserc.json once the numbers are known (#13).

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false # zizmor: artipacked
- name: Install Hugo (extended)
run: |
HUGO_VERSION="$(cat .hugoversion 2>/dev/null || echo 0.162.1)" # tracks .hugoversion once #15 lands
wget -O "${{ runner.temp }}/hugo.deb" \
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb"
sudo dpkg -i "${{ runner.temp }}/hugo.deb"
- name: Build site
env:
HUGO_ENVIRONMENT: production
TZ: UTC
run: hugo --gc --minify --baseURL "/"
- name: Lighthouse CI
uses: treosh/lighthouse-ci-action@3e7e23fb74242897f95c0ba9cabad3d0227b9b18 # 12.6.2
with:
configPath: ./lighthouserc.json
uploadArtifacts: true # store HTML reports as a GitHub artifact (no third-party upload)
temporaryPublicStorage: false
17 changes: 17 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ci": {
"collect": {
"staticDistDir": "./public",
"numberOfRuns": 3
},
"assert": {
"//": "Warnings to start (#13): record a baseline from the first runs, then ratchet these to 'error' floors just under it so regressions fail.",
"assertions": {
"categories:performance": ["warn", { "minScore": 0.9 }],
"categories:accessibility": ["warn", { "minScore": 0.95 }],
"categories:seo": ["warn", { "minScore": 0.95 }],
"categories:best-practices": ["warn", { "minScore": 0.95 }]
}
}
}
}
Loading