Skip to content

Commit 6d7d148

Browse files
authored
feat: lighthouse configuration (#10)
2 parents f0ca5bd + fc75a20 commit 6d7d148

File tree

5 files changed

+3036
-79
lines changed

5 files changed

+3036
-79
lines changed

.github/workflows/lighthouse.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lighthouse
2+
on: push
3+
jobs:
4+
static-dist-dir:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: actions/setup-node@v4
9+
with:
10+
node-version: 22.x
11+
- run: npm ci
12+
- run: npm run build --if-present
13+
- name: Run Lighthouse against a static dist dir.
14+
uses: treosh/lighthouse-ci-action@v11
15+
with:
16+
configPath: "./lighthouserc.json"

lighthouserc.cjs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
ci: {
3+
collect: {
4+
startServerCommand: "npm start",
5+
numberOfRuns: 3,
6+
url: ["http://localhost:4321/"],
7+
},
8+
upload: {
9+
target: "temporary-public-storage",
10+
},
11+
assert: {
12+
preset: 'lighthouse:recommended',
13+
assertions: {
14+
"categories:performance":
15+
["warn", {minScore: 0.8}],
16+
"categories.pwa": "off",
17+
},
18+
},
19+
settings: {
20+
onlyCategories: ["performance"],
21+
chromeFlags:
22+
"--headless --no-sandbox --disk-cache-size=0",
23+
"throttling-method": "devtools",
24+
throttling: {
25+
requestLatencyMs: 70,
26+
downloadThroughputKbps: 12000,
27+
cpuSlowdownMultiplier: 1,
28+
}
29+
}
30+
},
31+
};

lighthouserc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./dist"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)