Skip to content

Commit 8463e24

Browse files
authored
Merge pull request #221 from braboj/feature/lighthouse-ci
feat: add Lighthouse CI for quality scoring
2 parents e9d88bc + 4ab39cc commit 8463e24

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build:
1013
runs-on: ubuntu-latest

.github/workflows/lighthouse.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
lighthouse:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "22.12.0"
22+
cache: npm
23+
cache-dependency-path: astro-site/package-lock.json
24+
25+
- name: Install dependencies
26+
working-directory: astro-site
27+
run: npm ci
28+
29+
- name: Create assets symlink
30+
run: mkdir -p astro-site/src/content && ln -s ../../../assets astro-site/src/content/assets
31+
32+
- name: Build site
33+
working-directory: astro-site
34+
run: npm run build
35+
36+
- name: Lighthouse CI
37+
uses: treosh/lighthouse-ci-action@v12
38+
with:
39+
configPath: ./lighthouserc.json
40+
uploadArtifacts: true

lighthouserc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./astro-site/dist",
5+
"url": [
6+
"/",
7+
"/introduction/",
8+
"/building-blocks/",
9+
"/branching-and-merging/"
10+
]
11+
},
12+
"assert": {
13+
"assertions": {
14+
"categories:performance": ["warn", { "minScore": 0.9 }],
15+
"categories:accessibility": ["error", { "minScore": 0.9 }],
16+
"categories:best-practices": ["warn", { "minScore": 0.9 }],
17+
"categories:seo": ["warn", { "minScore": 0.9 }]
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)