diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml index 7db3448c..4938d75c 100644 --- a/.github/workflows/lhci.yml +++ b/.github/workflows/lhci.yml @@ -5,20 +5,33 @@ on: # Triggers the workflow when pull request is opened or updated pull_request: - types: [opened, synchronize, reopened, labeled] + types: [opened, synchronize, reopened] + paths: + - 'assets/**' + - 'content/**' + - 'layouts/**' + - 'static/js/**' + - '.github/workflows/lhci.yml' + - '.lighthouserc.json' + - 'hugo.toml' + +# Cancel an in-progress run for the same PR/branch when a new commit arrives +concurrency: + group: lighthouse-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: lighthouseci: - # Run this job if labeled with 'ci-lighthouse' - if: ${{ github.event.label.name == 'ci-lighthouse' }} runs-on: ubuntu-latest steps: #ref: https://github.com/actions/starter-workflows/tree/main/pages - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} + # Fall back to the triggering ref/repo when not run from a pull request + # (e.g. manual workflow_dispatch), where github.event.pull_request is empty + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: @@ -32,7 +45,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - run: npm install -g @lhci/cli@0.11.x + - run: npm install -g @lhci/cli@0.15.x # Collect Lighthouse results - run: lhci autorun env: diff --git a/.lighthouserc.json b/.lighthouserc.json index ef7ae85e..701557b8 100644 --- a/.lighthouserc.json +++ b/.lighthouserc.json @@ -2,48 +2,28 @@ "ci": { "collect": { "numberOfRuns": 1, - "startServerCommand": "hugo server --environment production", - "url": [ - "http://localhost:1313/", - "http://localhost:1313/accessibility-statement/", - "http://localhost:1313/contact/", - "http://localhost:1313/components/", - "http://localhost:1313/components/landmark/", - "http://localhost:1313/components/checkable/", - "http://localhost:1313/components/button-and-link/", - "http://localhost:1313/components/digital-info/", - "http://localhost:1313/components/form/", - "http://localhost:1313/components/official-document/", - "http://localhost:1313/components/skip-to/", - "http://localhost:1313/components/table/", - "http://localhost:1313/components/textarea/", - "http://localhost:1313/components/warning-text/", - "http://localhost:1313/components/accordion/", - "http://localhost:1313/components/tabs/", - "http://localhost:1313/technology/", - "http://localhost:1313/technology/anti_patterns/", - "http://localhost:1313/technology/internationalization/", - "http://localhost:1313/technology/progressive_enhancement/", - "http://localhost:1313/visual/", - "http://localhost:1313/visual/colors/", - "http://localhost:1313/visual/internationalization/", - "http://localhost:1313/visual/typography/" + "staticDistDir": "./public", + "maxAutodiscoverUrls": 0, + "staticDirFileDiscoveryDepth": 4, + "autodiscoverUrlBlocklist": [ + "http://localhost/categories/index.html", + "http://localhost/tags/index.html", + "http://localhost/components/landmark/blank.html", + "http://localhost/components/landmark/one-column.html", + "http://localhost/components/skip-to/skip-to.html", + "http://localhost/components/skip-to/skip-to-multiple.html", + "http://localhost/components/digital-info/digital-info.html" ], "settings": { "preset": "desktop" } }, "assert": { - "preset": "lighthouse:no-pwa", "assertions": { "categories:performance": ["warn", { "minScore": 0.9 }], "categories:accessibility": ["error", { "minScore": 1 }], - "csp-xss": "warn", - "is-crawlable": "warn", - "meta-description": "warn", - "unminified-css": "warn", - "unused-css-rules": "warn", - "uses-text-compression": "warn" + "categories:best-practices": ["warn"], + "categories:seo": ["warn"] } }, "upload": { diff --git a/layouts/home.html b/layouts/home.html index 0830bc02..e98bd1c7 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -28,7 +28,7 @@