Skip to content

Commit 36dc8cf

Browse files
build: add Lighthouse CI checks
1 parent ae2480e commit 36dc8cf

File tree

5 files changed

+3034
-434
lines changed

5 files changed

+3034
-434
lines changed

.github/workflows/lighthouse.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Lighthouse CI
2+
on: [push]
3+
jobs:
4+
lhci:
5+
name: Lighthouse
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: Use Node.js 22.x
10+
uses: actions/setup-node@v3
11+
with:
12+
node-version: 22.x
13+
- name: npm install, build
14+
run: |
15+
npm install
16+
npm run build
17+
- name: run Lighthouse CI
18+
run: |
19+
npm run lighthouse

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ testem.log
4747
.DS_Store
4848
Thumbs.db
4949
scully.log
50-
.nx/workspace-data
50+
.nx/workspace-data
51+
52+
.lighthouseci

.lighthouserc.cjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const staticDistDir = './dist/analog/public';
2+
3+
module.exports = {
4+
ci: {
5+
collect: {
6+
staticDistDir,
7+
url: ['http://localhost', 'http://localhost/blog'],
8+
maxAutodiscoverUrls: 0,
9+
},
10+
upload: {
11+
target: 'temporary-public-storage',
12+
},
13+
assert: {
14+
preset: "lighthouse:recommended",
15+
assertions: {
16+
"first-contentful-paint": [
17+
"warn",
18+
{
19+
"maxNumericValue": 2500,
20+
"aggregationMethod": "optimistic"
21+
}
22+
],
23+
interactive: [
24+
"warn",
25+
{
26+
"maxNumericValue": 5000,
27+
"aggregationMethod": "optimistic"
28+
}
29+
],
30+
"uses-long-cache-ttl": "off",
31+
"uses-http2": "off"
32+
}
33+
},
34+
},
35+
};

0 commit comments

Comments
 (0)