forked from StellarCheckMate/Checkmate-Escrow
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.88 KB
/
Copy pathfrontend-accessibility.yml
File metadata and controls
68 lines (58 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Frontend Accessibility (Lighthouse CI)
# Run on every push and pull request that touches the frontend or this workflow.
on:
push:
branches: [main, master]
paths:
- 'frontend/**'
- '.github/workflows/frontend-accessibility.yml'
pull_request:
branches: [main, master]
paths:
- 'frontend/**'
- '.github/workflows/frontend-accessibility.yml'
jobs:
lighthouse-accessibility:
name: Lighthouse Accessibility Audit
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
# ── 1. Checkout ──────────────────────────────────────────────────────
- name: Checkout repository
uses: actions/checkout@v4
# ── 2. Node.js setup ─────────────────────────────────────────────────
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
# ── 3. Install dependencies ───────────────────────────────────────────
- name: Install dependencies
run: npm ci
# ── 4. Build the frontend ─────────────────────────────────────────────
# Lighthouse CI needs a static build to audit; `npm run build` produces
# the ./dist directory referenced in lighthouserc.cjs.
- name: Build frontend
run: npm run build
# ── 5. Install Lighthouse CI ──────────────────────────────────────────
- name: Install @lhci/cli
run: npm install -g @lhci/cli@0.14.x
# ── 6. Run Lighthouse CI ──────────────────────────────────────────────
# Uses frontend/lighthouserc.cjs which asserts categories:accessibility >= 0.90.
# The step fails (exit code 1) if the score drops below the threshold,
# blocking the PR from merging.
- name: Run Lighthouse CI
run: lhci autorun --config=./lighthouserc.cjs
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
# ── 7. Upload Lighthouse report as artifact ───────────────────────────
- name: Upload Lighthouse results
if: always()
uses: actions/upload-artifact@v4
with:
name: lighthouse-accessibility-report
path: frontend/.lighthouseci/
retention-days: 30