From 0258aadb26ee47df8333ee8d884ca3050ec79683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Bregu=C3=AAz?= Date: Sun, 11 Oct 2026 18:08:36 -0300 Subject: [PATCH] ci: assert the median of 3 Lighthouse runs and keep the reports on failure A single run on a hosted runner scored performance 0.81 on main for the same commit that scored 1.0 on its pull request. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 1 + lighthouserc.json | 47 +++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a156fa7..67d4ff5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,3 +36,4 @@ jobs: test-results .lighthouseci if-no-files-found: ignore + include-hidden-files: true diff --git a/lighthouserc.json b/lighthouserc.json index 198c419..66e4b8e 100644 --- a/lighthouserc.json +++ b/lighthouserc.json @@ -3,18 +3,49 @@ "collect": { "startServerCommand": "npm run preview", "startServerReadyPattern": "Local", - "url": ["http://localhost:4173/#section=results"], - "numberOfRuns": 1, - "settings": { "chromeFlags": "--no-sandbox --headless=new" } + "url": [ + "http://localhost:4173/#section=results" + ], + "numberOfRuns": 3, + "settings": { + "chromeFlags": "--no-sandbox --headless=new" + } }, "assert": { "assertions": { - "categories:performance": ["error", { "minScore": 0.9 }], - "categories:accessibility": ["error", { "minScore": 0.9 }], - "categories:best-practices": ["error", { "minScore": 0.9 }], - "categories:seo": ["error", { "minScore": 0.9 }] + "categories:performance": [ + "error", + { + "minScore": 0.9, + "aggregationMethod": "median-run" + } + ], + "categories:accessibility": [ + "error", + { + "minScore": 0.9, + "aggregationMethod": "median-run" + } + ], + "categories:best-practices": [ + "error", + { + "minScore": 0.9, + "aggregationMethod": "median-run" + } + ], + "categories:seo": [ + "error", + { + "minScore": 0.9, + "aggregationMethod": "median-run" + } + ] } }, - "upload": { "target": "filesystem", "outputDir": ".lighthouseci" } + "upload": { + "target": "filesystem", + "outputDir": ".lighthouseci" + } } }