Skip to content

Commit 9c15561

Browse files
ci(perf): Lighthouse CI on PR + main push
Gates on user-observed Web Vitals: - accessibility >= 0.90 (ERROR if below — blocks) - CLS <= 0.10 (ERROR — blocks) - performance >= 0.80, LCP <= 2.5s, TBT <= 300ms (WARN — non-blocking) Free temporary-public-storage uploads results; the URL is printed in the CI log. Optional LHCI_GITHUB_APP_TOKEN enables PR-comment posting.
1 parent 99096fb commit 9c15561

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/lighthouse.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch: {}
9+
10+
env:
11+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
12+
13+
jobs:
14+
lighthouse:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
- run: npm ci
24+
25+
- name: Install Lighthouse CI
26+
run: npm install --no-save @lhci/cli
27+
28+
- name: Run Lighthouse CI
29+
run: npx lhci autorun --config=./.lighthouserc.cjs
30+
env:
31+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

.lighthouserc.cjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// .lighthouserc.cjs
2+
// Lighthouse CI config — runs against the local static server, gates
3+
// on Web Vitals budgets.
4+
5+
module.exports = {
6+
ci: {
7+
collect: {
8+
url: [
9+
'http://localhost:8011/index.html?eeg=/test-data/edfplus-with-annotations.edf',
10+
],
11+
startServerCommand: 'node scripts/serve.mjs 8011',
12+
startServerReadyPattern: 'Static server listening',
13+
numberOfRuns: 3,
14+
},
15+
assert: {
16+
assertions: {
17+
'categories:performance': ['warn', { minScore: 0.80 }],
18+
'categories:accessibility':['error', { minScore: 0.90 }],
19+
'categories:best-practices':['warn', { minScore: 0.85 }],
20+
// Specific Web Vitals:
21+
'largest-contentful-paint': ['warn', { maxNumericValue: 2500 }],
22+
'cumulative-layout-shift': ['error', { maxNumericValue: 0.10 }],
23+
'total-blocking-time': ['warn', { maxNumericValue: 300 }],
24+
},
25+
},
26+
upload: {
27+
target: 'temporary-public-storage',
28+
},
29+
},
30+
};

0 commit comments

Comments
 (0)