-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: New action for lighthouse (#572)
- Loading branch information
Showing
2 changed files
with
35 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"ci": { | ||
"collect": { | ||
"staticDistDir": "./docs/_build/html", | ||
"settings": { | ||
"skipAudits": ["canonical"] | ||
} | ||
}, | ||
"assert": { | ||
"assertions": { | ||
"categories:performance": ["error", { "minScore": 0.1 }], | ||
"categories:accessibility": ["error", { "minScore": 0.96 }], | ||
"categories:best-practices": ["error", { "minScore": 0.85 }], | ||
"categories:seo": ["error", { "minScore": 0.8 }] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,54 +106,34 @@ jobs: | |
run: | | ||
sphinx-build -b html docs/ docs/_build/html | ||
# Serve the docs and wait to be ready | ||
# The lighthouse audit runs directly on the HTML files, no serving needed | ||
- name: Audit with Lighthouse | ||
uses: treosh/lighthouse-ci-action@v8 | ||
with: | ||
configPath: ".github/workflows/lighthouserc.json" | ||
temporaryPublicStorage: true | ||
uploadArtifacts: true | ||
runs: 3 # Multiple runs to reduce variance | ||
urls: | | ||
demo/kitchen-sink/paragraph-markup.html | ||
demo/example_pandas.html | ||
demo/theme-elements.html | ||
# Serve the docs for auditing with pa11y | ||
- name: Serve the built site | ||
run: | | ||
nohup python docs/serve.py --port=${PORT} --host=${HOST} & | ||
curl --retry 10 --retry-connrefused --retry-max-time 60 ${URL}/index.html | ||
# Run the audit | ||
# TODO: use the hosted API with a secret? would allow for comparison over time... | ||
- name: Make folder for Lighthouse reports | ||
run: mkdir -p /tmp/lighthouse/lighthouse-${{ github.run_number }} | ||
|
||
- name: Run Lighthouse on Site | ||
id: lighthouse | ||
uses: foo-software/[email protected] | ||
with: | ||
# TODO: generate this list to audit all html pages | ||
urls: >- | ||
${{ env.URL }}/index.html, | ||
${{ env.URL }}/demo/api.html, | ||
${{ env.URL }}/demo/kitchen-sink/paragraph-markup.html, | ||
${{ env.URL }}/demo/kitchen-sink/lists-and-tables.html, | ||
${{ env.URL }}/demo/example_pandas.html, | ||
${{ env.URL }}/user_guide/accessibility.html | ||
outputDirectory: /tmp/lighthouse/lighthouse-${{ github.run_number }} | ||
verbose: true | ||
|
||
- name: Run the accessibility audit | ||
- name: Audit with pa11y | ||
run: python docs/scripts/a11y.py --no-serve | ||
|
||
# Check the audit for threshold values | ||
# TODO: write this someplace after a PR is merged, and load? | ||
- name: Assess Lighthouse Check results | ||
uses: foo-software/[email protected] | ||
with: | ||
lighthouseCheckResults: ${{ steps.lighthouse.outputs.lighthouseCheckResults }} | ||
minAccessibilityScore: "96" | ||
minBestPracticesScore: "85" | ||
minPerformanceScore: "10" | ||
minSeoScore: "80" | ||
if: always() | ||
|
||
- name: Publish Audit reports | ||
- name: Publish pa11y report | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Pa11y and Lighthouse ${{ github.run_number }} | ||
name: Pa11y ${{ github.run_number }} | ||
path: | | ||
/tmp/pa11y | ||
/tmp/lighthouse | ||
if: always() | ||
|
||
publish: | ||
|