Skip to content

Commit a2b627b

Browse files
committed
Add GitHub Action for Unlighthouse site scan
This workflow automates site performance and budget checks using Unlighthouse. It builds the SvelteKit preview, runs assertions, generates reports, and uploads them for further analysis.
1 parent 3af546b commit a2b627b

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/unlighouse.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Unlighthouse Site Scan
2+
on: [push]
3+
4+
jobs:
5+
unlighthouse-site-scan:
6+
runs-on: ubuntu-latest
7+
timeout-minutes: 10
8+
9+
steps:
10+
- name: Checkout Repository
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 1
14+
15+
- name: Setup Bun
16+
uses: oven-sh/setup-bun@v2
17+
18+
- name: Install Dependencies
19+
run: bun install -g @unlighthouse/cli puppeteer
20+
21+
- name: Build SvelteKit Preview
22+
run: make build
23+
24+
# Run build in background and log output
25+
- name: Start Preview Server
26+
run: |
27+
bun run preview --port 4173 &
28+
echo "Waiting for preview to start on port 4173…"
29+
bunx wait-on http://localhost:4173
30+
31+
- name: Run Unlighthouse Assertions & Generate Static Report
32+
run: |
33+
unlighthouse-ci \
34+
--site http://localhost:4173 \
35+
--budget 75 \
36+
--upload.target=lhci \
37+
--upload.serverBaseUrl=https://lhci-server-crimson-bush-1151.fly.dev \
38+
--upload.token=${{ secrets.LHCI_BUILD_TOKEN }}
39+
40+
- name: Upload Unlighthouse Report
41+
uses: actions/upload-artifact@v4
42+
if: ${{ !cancelled() }}
43+
with:
44+
name: unlighthouse-report
45+
path: .unlighthouse/**/*
46+
include-hidden-files: true
47+
retention-days: 30

0 commit comments

Comments
 (0)