From ceaee3b53608d6d9f8d356759ea892b3e3bbd662 Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Sat, 6 Sep 2025 19:52:42 +0530 Subject: [PATCH] improve: Implement CodeRabbit AI suggestions for better CI reliability - Add Chrome setup step using browser-actions/setup-chrome@v1 - Simplify Lighthouse CI command to use existing lighthouserc.js config - Update lighthouserc.js to use warn-level assertions with realistic thresholds - Remove long CLI flags in favor of maintainable config file approach - Ensures Chrome availability and prevents flaky CI failures --- .github/workflows/ci-cd.yml | 5 ++++- lighthouserc.js | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index c1f6fcb44..992e7db0e 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -587,10 +587,13 @@ jobs: - name: Install dependencies run: npm ci + - name: Setup Chrome + uses: browser-actions/setup-chrome@v1 + - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.12.x - lhci autorun --assert.assertions.categories:performance=warn --assert.assertions.categories:accessibility=warn --assert.assertions.categories:best-practices=warn --assert.assertions.categories:seo=warn --assert.assertions.first-contentful-paint=warn --assert.assertions.largest-contentful-paint=warn --assert.assertions.cumulative-layout-shift=warn --assert.assertions.total-blocking-time=warn --assert.assertions.speed-index=warn + lhci autorun env: LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} LHCI_TOKEN: ${{ secrets.LHCI_TOKEN }} diff --git a/lighthouserc.js b/lighthouserc.js index b18cc31f5..07c38f8c8 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -20,15 +20,15 @@ module.exports = { }, assert: { assertions: { - 'categories:performance': ['error', { minScore: 0.8 }], - 'categories:accessibility': ['error', { minScore: 0.9 }], - 'categories:best-practices': ['error', { minScore: 0.9 }], - 'categories:seo': ['error', { minScore: 0.9 }], - 'first-contentful-paint': ['error', { maxNumericValue: 2000 }], - 'largest-contentful-paint': ['error', { maxNumericValue: 2500 }], - 'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }], - 'total-blocking-time': ['error', { maxNumericValue: 300 }], - 'speed-index': ['error', { maxNumericValue: 3000 }] + 'categories:performance': ['warn', { minScore: 0.6 }], + 'categories:accessibility': ['warn', { minScore: 0.85 }], + 'categories:best-practices': ['warn', { minScore: 0.85 }], + 'categories:seo': ['warn', { minScore: 0.8 }], + 'first-contentful-paint': ['warn', { maxNumericValue: 3000 }], + 'largest-contentful-paint': ['warn', { maxNumericValue: 4000 }], + 'cumulative-layout-shift': ['warn', { maxNumericValue: 0.15 }], + 'total-blocking-time': ['warn', { maxNumericValue: 1000 }], + 'speed-index': ['warn', { maxNumericValue: 5000 }] } }, upload: {