Skip to content

Commit ae9b8b8

Browse files
HazATclaude
andcommitted
feat(lighthouse-ci): add nightly + label-gated lighthouse jobs to build.yml
Insert three new jobs between job_optional_e2e_tests and job_required_jobs_passed in the CI workflow: - job_lighthouse_matrix: generates the test matrix (apps × modes), gated on schedule (nightly) or 'ci:lighthouse' PR label - job_lighthouse: runs each matrix cell on ubuntu-24.04-large-js with continue-on-error: true and max-parallel: 15. Mirrors the job_e2e_tests prep recipe (pnpm 9.15.9, Node from app package.json, restore-cache, download build-tarball-output, yarn test:prepare, ci:copy-to-temp, ci:pnpm-overrides). Build step sets SENTRY_LIGHTHOUSE_MODE under every common bundler env prefix (NEXT_PUBLIC_, PUBLIC_, REACT_APP_) so each app reads whichever its bundler exposes. Uses treosh/lighthouse-ci-action@v12 with numberOfRuns: 5 and temporaryPublicStorage: true. - job_lighthouse_report: downloads all lighthouse artifacts and runs post-comment.mjs to generate a summary table / PR comment Extended on.pull_request to include types: [opened, synchronize, reopened, labeled] so the labeled event fires when ci:lighthouse is added to a PR. Security: NO pull_request_target, NO new permissions block, NO new secrets beyond GITHUB_TOKEN, NOT added to job_required_jobs_passed needs[] — lighthouse failures never block merges. Ref: TODO-1d15a08e, plan rev 2 Co-Authored-By: Claude claude-opus-4-6 <noreply@anthropic.com>
1 parent cc37d4d commit ae9b8b8

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- v8
99
- release/**
1010
pull_request:
11+
types: [opened, synchronize, reopened, labeled]
1112
merge_group:
1213
types: [checks_requested]
1314
workflow_dispatch:
@@ -1201,6 +1202,138 @@ jobs:
12011202
retention-days: 7
12021203
if-no-files-found: ignore
12031204

1205+
# -----------------------------------------------------------------------
1206+
# Lighthouse CI — nightly + label-gated (ci:lighthouse)
1207+
# NOT in job_required_jobs_passed — never blocks merges.
1208+
# -----------------------------------------------------------------------
1209+
1210+
job_lighthouse_matrix:
1211+
name: Lighthouse Matrix
1212+
needs: [job_get_metadata]
1213+
runs-on: ubuntu-24.04
1214+
if: |
1215+
github.event_name == 'schedule' ||
1216+
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:lighthouse'))
1217+
outputs:
1218+
matrix: ${{ steps.matrix.outputs.matrix }}
1219+
steps:
1220+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
1221+
uses: actions/checkout@v6
1222+
with:
1223+
ref: ${{ env.HEAD_COMMIT }}
1224+
- name: Set up Node
1225+
uses: actions/setup-node@v6
1226+
with:
1227+
node-version: lts/*
1228+
- name: Generate matrix
1229+
id: matrix
1230+
run: node dev-packages/lighthouse-tests/lighthouse-matrix.mjs
1231+
1232+
job_lighthouse:
1233+
name: Lighthouse ${{ matrix.test-application }} (${{ matrix.mode }})
1234+
needs: [job_get_metadata, job_build, job_build_tarballs, job_lighthouse_matrix]
1235+
if: always() && needs.job_build_tarballs.result == 'success' && needs.job_lighthouse_matrix.result == 'success'
1236+
runs-on: ubuntu-24.04-large-js
1237+
timeout-minutes: 20
1238+
continue-on-error: true
1239+
strategy:
1240+
fail-fast: false
1241+
max-parallel: 15
1242+
matrix: ${{ fromJson(needs.job_lighthouse_matrix.outputs.matrix) }}
1243+
steps:
1244+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
1245+
uses: actions/checkout@v6
1246+
with:
1247+
ref: ${{ env.HEAD_COMMIT }}
1248+
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
1249+
with:
1250+
version: 9.15.9
1251+
- name: Set up Node
1252+
uses: actions/setup-node@v6
1253+
with:
1254+
node-version-file: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json'
1255+
- name: Restore caches
1256+
uses: ./.github/actions/restore-cache
1257+
with:
1258+
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
1259+
1260+
- name: Restore tarball artifacts
1261+
uses: actions/download-artifact@v7
1262+
with:
1263+
name: build-tarball-output
1264+
path: ${{ env.TARBALL_ARTIFACT_DOWNLOAD_PATH }}
1265+
1266+
- name: Prepare E2E tests
1267+
run: yarn test:prepare
1268+
working-directory: dev-packages/e2e-tests
1269+
1270+
- name: Copy to temp
1271+
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
1272+
working-directory: dev-packages/e2e-tests
1273+
1274+
- name: Add pnpm overrides
1275+
run:
1276+
yarn ci:pnpm-overrides ${{ runner.temp }}/test-application ${{ github.workspace
1277+
}}/dev-packages/e2e-tests/packed
1278+
working-directory: dev-packages/e2e-tests
1279+
1280+
- name: Build E2E app for Lighthouse
1281+
working-directory: ${{ runner.temp }}/test-application
1282+
timeout-minutes: 7
1283+
run: ${{ matrix.build-command || 'pnpm test:build' }}
1284+
env:
1285+
# Set under every common bundler env prefix so each app reads whichever its bundler exposes
1286+
SENTRY_LIGHTHOUSE_MODE: ${{ matrix.mode }}
1287+
NEXT_PUBLIC_SENTRY_LIGHTHOUSE_MODE: ${{ matrix.mode }}
1288+
PUBLIC_SENTRY_LIGHTHOUSE_MODE: ${{ matrix.mode }}
1289+
REACT_APP_SENTRY_LIGHTHOUSE_MODE: ${{ matrix.mode }}
1290+
1291+
- name: Run Lighthouse CI
1292+
uses: treosh/lighthouse-ci-action@v12
1293+
with:
1294+
configPath: dev-packages/lighthouse-tests/lighthouserc.js
1295+
uploadArtifacts: true
1296+
temporaryPublicStorage: true
1297+
runs: 5
1298+
urls: ${{ matrix.url || 'http://localhost:3000/' }}
1299+
startServerCommand: ${{ matrix.serve-command || '' }}
1300+
startServerReadyTimeout: 30000
1301+
1302+
- name: Upload Lighthouse results
1303+
uses: actions/upload-artifact@v7
1304+
if: always()
1305+
with:
1306+
name: lighthouse-${{ matrix.test-application }}-${{ matrix.mode }}
1307+
path: .lighthouseci/
1308+
retention-days: 7
1309+
if-no-files-found: ignore
1310+
1311+
job_lighthouse_report:
1312+
name: Lighthouse Report
1313+
needs: [job_lighthouse]
1314+
if: always() && needs.job_lighthouse.result != 'cancelled'
1315+
runs-on: ubuntu-24.04
1316+
steps:
1317+
- name: Check out current commit
1318+
uses: actions/checkout@v6
1319+
with:
1320+
ref: ${{ env.HEAD_COMMIT }}
1321+
- name: Set up Node
1322+
uses: actions/setup-node@v6
1323+
with:
1324+
node-version: lts/*
1325+
- name: Download all Lighthouse artifacts
1326+
uses: actions/download-artifact@v7
1327+
with:
1328+
pattern: lighthouse-*
1329+
path: lighthouse-results/
1330+
- name: Generate report
1331+
run: node dev-packages/lighthouse-tests/post-comment.mjs
1332+
env:
1333+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1334+
GITHUB_EVENT_NAME: ${{ github.event_name }}
1335+
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
1336+
12041337
job_required_jobs_passed:
12051338
name: All required jobs passed or were skipped
12061339
needs:

0 commit comments

Comments
 (0)