Skip to content

Commit 78bc4db

Browse files
committed
Create lighthouse.yml
1 parent ae65d6c commit 78bc4db

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/lighthouse.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
run: pnpm build
39+
40+
- name: Start server
41+
run: |
42+
pnpm start &
43+
echo "Waiting for server to be ready..."
44+
while ! nc -z localhost 3000; do
45+
sleep 5
46+
done
47+
# Additional wait to ensure full initialization
48+
sleep 20
49+
50+
- name: Run Lighthouse CI
51+
run: |
52+
pnpm lhci:perf
53+
pnpm lhci:desktop
54+
env:
55+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Stop server
58+
if: always()
59+
run: |
60+
pkill -f "next start" || true

0 commit comments

Comments
 (0)