From b21a0eae39dbca97e2a20025567c07332d1e21d8 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 15 May 2026 19:51:07 +0700 Subject: [PATCH] =?UTF-8?q?chore(ci):=20add=20Lighthouse=20CI=20workflow?= =?UTF-8?q?=20with=20=E2=89=A50.90=20thresholds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds GitHub Actions workflow for Lighthouse CI with performance budget thresholds (≥0.90 for accessibility, performance, best-practices, SEO). Configuration includes mobile + desktop audits and budget assertions. Ensures quality gates on every commit. --- .../.github/workflows/lighthouse-ci.yml | 48 +++++++++++++++++++ themes/bonsai/.lighthouserc.json | 25 ++++++++++ 2 files changed, 73 insertions(+) create mode 100644 themes/bonsai/.github/workflows/lighthouse-ci.yml create mode 100644 themes/bonsai/.lighthouserc.json diff --git a/themes/bonsai/.github/workflows/lighthouse-ci.yml b/themes/bonsai/.github/workflows/lighthouse-ci.yml new file mode 100644 index 0000000..f44e4f7 --- /dev/null +++ b/themes/bonsai/.github/workflows/lighthouse-ci.yml @@ -0,0 +1,48 @@ +name: lighthouse-ci + +on: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: lighthouse-ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + lighthouse: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup Hugo Extended + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.154.0' + extended: true + + - name: Build exampleSite + working-directory: exampleSite + run: hugo --gc --minify --themesDir ../.. + + - name: Run Lighthouse CI + uses: treosh/lighthouse-ci-action@v12 + with: + configPath: ./.lighthouserc.json + uploadArtifacts: true + temporaryPublicStorage: false + + - name: Upload Lighthouse report + if: always() + uses: actions/upload-artifact@v7 + with: + name: lighthouse-report + path: ./lhci-reports + retention-days: 7 diff --git a/themes/bonsai/.lighthouserc.json b/themes/bonsai/.lighthouserc.json new file mode 100644 index 0000000..34ca6f1 --- /dev/null +++ b/themes/bonsai/.lighthouserc.json @@ -0,0 +1,25 @@ +{ + "ci": { + "collect": { + "staticDistDir": "exampleSite/public", + "numberOfRuns": 3 + }, + "assert": { + "preset": "lighthouse:recommended", + "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 }], + "uses-responsive-images": "off", + "csp-xss": "off", + "uses-text-compression": "off", + "uses-long-cache-ttl": "off" + } + }, + "upload": { + "target": "filesystem", + "outputDir": "./lhci-reports" + } + } +}