File tree Expand file tree Collapse file tree 4 files changed +5535
-1026
lines changed Expand file tree Collapse file tree 4 files changed +5535
-1026
lines changed Original file line number Diff line number Diff line change
1
+ name : Lighthouse CI
2
+ on : [push, pull_request]
3
+
4
+ jobs :
5
+ lighthouse :
6
+ runs-on : ubuntu-latest
7
+ steps :
8
+ - uses : actions/checkout@v4
9
+
10
+ - name : Setup Node.js
11
+ uses : actions/setup-node@v4
12
+ with :
13
+ node-version : ' 20'
14
+
15
+ - name : Setup pnpm
16
+ uses : pnpm/action-setup@v2
17
+ with :
18
+ version : 8
19
+ run_install : false
20
+
21
+ - name : Get pnpm store directory
22
+ shell : bash
23
+ run : |
24
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
25
+
26
+ - name : Setup pnpm cache
27
+ uses : actions/cache@v4
28
+ with :
29
+ path : ${{ env.STORE_PATH }}
30
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
31
+ restore-keys : |
32
+ ${{ runner.os }}-pnpm-store-
33
+
34
+ - name : Install dependencies
35
+ run : pnpm install
36
+
37
+ - name : Build project
38
+ env :
39
+ NEXT_PUBLIC_GRAPHQL_URL : " https://swewoocommerce.dfweb.no/graphql"
40
+ NEXT_PUBLIC_PLACEHOLDER_SMALL_IMAGE_URL : " https://via.placeholder.com/200"
41
+ NEXT_PUBLIC_PLACEHOLDER_LARGE_IMAGE_URL : " https://via.placeholder.com/600"
42
+ run : pnpm build
43
+
44
+ - name : Start server
45
+ env :
46
+ NEXT_PUBLIC_GRAPHQL_URL : " https://swewoocommerce.dfweb.no/graphql"
47
+ NEXT_PUBLIC_PLACEHOLDER_SMALL_IMAGE_URL : " https://via.placeholder.com/200"
48
+ NEXT_PUBLIC_PLACEHOLDER_LARGE_IMAGE_URL : " https://via.placeholder.com/600"
49
+ run : |
50
+ pnpm start &
51
+ echo "Waiting for server to be ready..."
52
+ while ! nc -z localhost 3000; do
53
+ sleep 5
54
+ done
55
+ # Additional wait to ensure full initialization
56
+ sleep 20
57
+
58
+ - name : Run Lighthouse CI
59
+ run : |
60
+ pnpm lhci:perf
61
+ pnpm lhci:desktop
62
+ env :
63
+ LHCI_GITHUB_APP_TOKEN : ${{ secrets.GITHUB_TOKEN }}
64
+
65
+ - name : Stop server
66
+ if : always()
67
+ run : |
68
+ pkill -f "next start" || true
Original file line number Diff line number Diff line change
1
+ {
2
+ "ci" : {
3
+ "collect" : {
4
+ "numberOfRuns" : 1 ,
5
+ "url" : [
6
+ " http://localhost:3000/" ,
7
+ " http://localhost:3000/produkter" ,
8
+ " http://localhost:3000/kategorier"
9
+ ],
10
+ "port" : 3000 ,
11
+ "settings" : {
12
+ "onlyCategories" : [
13
+ " performance" ,
14
+ " accessibility" ,
15
+ " best-practices" ,
16
+ " seo"
17
+ ],
18
+ "skipAudits" : [" uses-http2" ]
19
+ }
20
+ },
21
+ "upload" : { "target" : " temporary-public-storage" },
22
+ "assert" : {
23
+ "assertions" : {
24
+ "categories:performance" : [" warn" , { "minScore" : 0.6 }],
25
+ "categories:accessibility" : [" warn" , { "minScore" : 0.9 }],
26
+ "categories:best-practices" : [" warn" , { "minScore" : 0.9 }],
27
+ "categories:seo" : [" warn" , { "minScore" : 0.9 }],
28
+ "uses-http2" : " off"
29
+ }
30
+ }
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments