-
Notifications
You must be signed in to change notification settings - Fork 42
70 lines (59 loc) · 2.22 KB
/
Copy pathlighthouse.yml
File metadata and controls
70 lines (59 loc) · 2.22 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
69
70
# Lighthouse CI: enforces performance, accessibility, and resource budgets
# on the BOxCrete website. Runs on PRs that touch the site.
# Configuration: lighthouserc.json + budgets.json.
name: Lighthouse CI
# Cancel obsolete runs on rapid pushes.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main, master]
paths: &lighthouse_paths
- 'docs/**'
- 'lighthouserc.json'
- 'lighthouserc.mobile.json'
- '.github/workflows/lighthouse.yml'
pull_request:
branches: [main, master]
paths: *lighthouse_paths
workflow_dispatch:
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lighthouse:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# Desktop and mobile are separate Lighthouse profiles, not one run with
# two viewports. Only desktop was ever measured, which is why a 6 px
# touch target and 1.2 s of mobile blocking time both shipped unnoticed.
#
# Deliberately two steps in ONE job rather than a matrix: a matrix job's
# check-run name becomes "lighthouse (<matrix values>)", so any branch
# protection requiring the "lighthouse" context would wait forever on a
# status that is never reported again. Keeping a single job preserves
# the existing check name.
- name: Run Lighthouse CI (desktop)
run: npx lhci autorun --config=lighthouserc.json
env:
# Public uploads to temporary-public-storage are anonymous;
# no token required for our config.
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
# `if: always()` so a desktop failure still reports the mobile result --
# otherwise the profile this change exists to add would be skipped
# exactly when something is wrong.
- name: Run Lighthouse CI (mobile)
if: always()
run: npx lhci autorun --config=lighthouserc.mobile.json
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}