Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/lhci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@ 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/**'

# 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:
Expand All @@ -32,7 +42,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:
Expand Down
46 changes: 13 additions & 33 deletions .lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2 class="heading5 tc mt5">設計制度內容</h2>
<div class="ph2 tc w-100" style="flex: 1 1 calc(33.333% - 2rem)">
<a class="db" {{ with $doc }}href="{{ .RelPermalink }}" {{ end }}>
<div class="w-70 center">
<img src="{{ $svgPath | relURL }}" alt="{{ .Title }}" />
<img src="{{ $svgPath | relURL }}" alt="" />
</div>
<div class="mt3">{{ .Title }}</div>
</a>
Expand Down
Loading