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" + } + } +}