Skip to content

Commit 8453f38

Browse files
authored
MAINT: New action for lighthouse (#572)
1 parent e1cd341 commit 8453f38

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./docs/_build/html",
5+
"settings": {
6+
"skipAudits": ["canonical"]
7+
}
8+
},
9+
"assert": {
10+
"assertions": {
11+
"categories:performance": ["error", { "minScore": 0.1 }],
12+
"categories:accessibility": ["error", { "minScore": 0.96 }],
13+
"categories:best-practices": ["error", { "minScore": 0.85 }],
14+
"categories:seo": ["error", { "minScore": 0.8 }]
15+
}
16+
}
17+
}
18+
}

.github/workflows/tests.yml

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -106,54 +106,34 @@ jobs:
106106
run: |
107107
sphinx-build -b html docs/ docs/_build/html
108108
109-
# Serve the docs and wait to be ready
109+
# The lighthouse audit runs directly on the HTML files, no serving needed
110+
- name: Audit with Lighthouse
111+
uses: treosh/lighthouse-ci-action@v8
112+
with:
113+
configPath: ".github/workflows/lighthouserc.json"
114+
temporaryPublicStorage: true
115+
uploadArtifacts: true
116+
runs: 3 # Multiple runs to reduce variance
117+
urls: |
118+
demo/kitchen-sink/paragraph-markup.html
119+
demo/example_pandas.html
120+
demo/theme-elements.html
121+
122+
# Serve the docs for auditing with pa11y
110123
- name: Serve the built site
111124
run: |
112125
nohup python docs/serve.py --port=${PORT} --host=${HOST} &
113126
curl --retry 10 --retry-connrefused --retry-max-time 60 ${URL}/index.html
114127
115-
# Run the audit
116-
# TODO: use the hosted API with a secret? would allow for comparison over time...
117-
- name: Make folder for Lighthouse reports
118-
run: mkdir -p /tmp/lighthouse/lighthouse-${{ github.run_number }}
119-
120-
- name: Run Lighthouse on Site
121-
id: lighthouse
122-
uses: foo-software/[email protected]
123-
with:
124-
# TODO: generate this list to audit all html pages
125-
urls: >-
126-
${{ env.URL }}/index.html,
127-
${{ env.URL }}/demo/api.html,
128-
${{ env.URL }}/demo/kitchen-sink/paragraph-markup.html,
129-
${{ env.URL }}/demo/kitchen-sink/lists-and-tables.html,
130-
${{ env.URL }}/demo/example_pandas.html,
131-
${{ env.URL }}/user_guide/accessibility.html
132-
outputDirectory: /tmp/lighthouse/lighthouse-${{ github.run_number }}
133-
verbose: true
134-
135-
- name: Run the accessibility audit
128+
- name: Audit with pa11y
136129
run: python docs/scripts/a11y.py --no-serve
137130

138-
# Check the audit for threshold values
139-
# TODO: write this someplace after a PR is merged, and load?
140-
- name: Assess Lighthouse Check results
141-
uses: foo-software/[email protected]
142-
with:
143-
lighthouseCheckResults: ${{ steps.lighthouse.outputs.lighthouseCheckResults }}
144-
minAccessibilityScore: "96"
145-
minBestPracticesScore: "85"
146-
minPerformanceScore: "10"
147-
minSeoScore: "80"
148-
if: always()
149-
150-
- name: Publish Audit reports
131+
- name: Publish pa11y report
151132
uses: actions/upload-artifact@v2
152133
with:
153-
name: Pa11y and Lighthouse ${{ github.run_number }}
134+
name: Pa11y ${{ github.run_number }}
154135
path: |
155136
/tmp/pa11y
156-
/tmp/lighthouse
157137
if: always()
158138

159139
publish:

0 commit comments

Comments
 (0)