mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 02:22:17 +00:00
ci(lighthouse): stop lhci reading the form factor as a CLI flag
lhci treats every LHCI_* environment variable as a command-line option, so LHCI_PRESET=mobile reached `lhci assert` as an invalid --preset and failed both jobs after the audits had run. Use LIGHTHOUSE_FORM_FACTOR instead. Also upload the reports: upload-artifact v4+ skips dot-directories such as .lighthouseci unless include-hidden-files is set.
This commit is contained in:
@@ -86,7 +86,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
preset: [mobile, desktop]
|
form-factor: [mobile, desktop]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v5
|
||||||
@@ -97,13 +97,16 @@ jobs:
|
|||||||
# The homepage streams public stats from the database, so audit against a real stack.
|
# The homepage streams public stats from the database, so audit against a real stack.
|
||||||
- run: npx supabase start
|
- run: npx supabase start
|
||||||
- run: npm run test:lighthouse
|
- run: npm run test:lighthouse
|
||||||
|
# Not LHCI_*: lhci reads any LHCI_ variable as a CLI flag (LHCI_PRESET became `--preset`).
|
||||||
env:
|
env:
|
||||||
LHCI_PRESET: ${{ matrix.preset }}
|
LIGHTHOUSE_FORM_FACTOR: ${{ matrix.form-factor }}
|
||||||
- uses: actions/upload-artifact@v6
|
- uses: actions/upload-artifact@v6
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: lighthouse-${{ matrix.preset }}
|
name: lighthouse-${{ matrix.form-factor }}
|
||||||
path: .lighthouseci/
|
path: .lighthouseci/
|
||||||
|
# upload-artifact v4+ skips dot-directories unless told otherwise.
|
||||||
|
include-hidden-files: true
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
- if: always()
|
- if: always()
|
||||||
run: npx supabase stop
|
run: npx supabase stop
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ The test suite is split by responsibility so a failure points to the correct lay
|
|||||||
- `lighthouserc.cjs` audits the public pages with Lighthouse CI (`npm run test:lighthouse`, which
|
- `lighthouserc.cjs` audits the public pages with Lighthouse CI (`npm run test:lighthouse`, which
|
||||||
builds and serves the Node output). PRs fail if Performance, Accessibility, Best Practices or SEO
|
builds and serves the Node output). PRs fail if Performance, Accessibility, Best Practices or SEO
|
||||||
drops below 90, or if LCP, TBT, CLS, script, stylesheet or total transfer size exceeds its budget.
|
drops below 90, or if LCP, TBT, CLS, script, stylesheet or total transfer size exceeds its budget.
|
||||||
CI runs it with both the mobile and desktop profiles (`LHCI_PRESET=desktop`).
|
CI runs it with both the mobile and desktop profiles (`LIGHTHOUSE_FORM_FACTOR=desktop`).
|
||||||
- `tests/bdd/features/performance.feature` holds time budgets for signed-in pages Lighthouse can't
|
- `tests/bdd/features/performance.feature` holds time budgets for signed-in pages Lighthouse can't
|
||||||
reach: opening a Pokédex and switching between it and the Pokédex list.
|
reach: opening a Pokédex and switching between it and the Pokédex list.
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,8 +1,10 @@
|
|||||||
// Lighthouse CI: `npm run test:lighthouse` builds the Node adapter output, serves it and audits the
|
// Lighthouse CI: `npm run test:lighthouse` builds the Node adapter output, serves it and audits the
|
||||||
// public pages. Any category below 90 fails the run (and so the PR).
|
// public pages. Any category below 90 fails the run (and so the PR).
|
||||||
// Set LHCI_PRESET=desktop to audit with the desktop profile; the default is Lighthouse's mobile
|
// Set LIGHTHOUSE_FORM_FACTOR=desktop to audit with the desktop profile; the default is Lighthouse's
|
||||||
// profile (slow 4G + CPU throttling), which is the stricter of the two.
|
// mobile profile (slow 4G + CPU throttling), which is the stricter of the two. The variable must not
|
||||||
const preset = process.env.LHCI_PRESET === 'desktop' ? 'desktop' : undefined;
|
// start with LHCI_: lhci treats those as CLI flags, so LHCI_PRESET was passed to `lhci assert` as
|
||||||
|
// an invalid `--preset`.
|
||||||
|
const preset = process.env.LIGHTHOUSE_FORM_FACTOR === 'desktop' ? 'desktop' : undefined;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ci: {
|
ci: {
|
||||||
|
|||||||
Reference in New Issue
Block a user