-
Notifications
You must be signed in to change notification settings - Fork 11
66 lines (63 loc) · 2.23 KB
/
lighthouse.yaml
File metadata and controls
66 lines (63 loc) · 2.23 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
name: 🔦 Lighthouse
on:
deployment_status:
concurrency:
group: lighthouse-${{ github.event.deployment.ref }}
cancel-in-progress: true
jobs:
lighthouse:
name: "Lighthouse audit"
if: >
github.event.deployment_status.state == 'success' &&
!startsWith(github.event.deployment.environment, 'build-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.deployment.ref }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Load SocialGouv variables
id: env
uses: socialgouv/kontinuous/.github/actions/env@v1
- name: Run Lighthouse CI
run: pnpm test:lighthouse
continue-on-error: true
id: lighthouse
env:
LIGHTHOUSE_URL: https://${{ steps.env.outputs.subdomain }}.ovh.fabrique.social.gouv.fr
- name: Show Lighthouse scores
if: always()
working-directory: packages/app
run: |
echo "=== Lighthouse scores ==="
find .lighthouseci -name "*.report.json" 2>/dev/null | while read f; do
echo "Report: $f"
node -e "
const r = require(require('path').resolve(process.argv[1]));
const c = r.categories;
Object.entries(c).forEach(([k, v]) => {
const score = Math.round(v.score * 100);
const icon = score >= 90 ? 'OK' : score >= 50 ? 'WARN' : 'FAIL';
console.log('[' + icon + '] ' + k + ': ' + score + '/100');
});
" "$f"
echo ""
done || echo "No report files found"
echo "=== Files in .lighthouseci ==="
ls -lh .lighthouseci/ 2>/dev/null || echo "Directory empty or missing"
- name: Upload Lighthouse report
uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-report
path: packages/app/.lighthouseci/
retention-days: 7
- name: Fail if Lighthouse asserted errors
if: steps.lighthouse.outcome == 'failure'
run: exit 1