Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Use different lighthouse action #548

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 25 additions & 0 deletions .github/workflows/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"ci": {
"collect": {
"staticDistDir": "./docs/_build/html",
"autodiscoverUrlBlocklist": [
"index.html",
"demo/api.html",
"demo/demo.html",
"demo/example_pandas.html",
"user_guide/accessibility.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 }]
}
}
}
}
57 changes: 7 additions & 50 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,61 +102,18 @@ jobs:
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install -e .[coverage]
yarn --frozen-lockfile

# Build the docs
- name: Build docs to store
run: |
sphinx-build -b html docs/ docs/_build/html -W --keep-going

# Serve the docs and wait to be ready
- name: Serve the built site
- name: Build docs to audit
run: |
nohup python docs/serve.py --port=${PORT} --host=${HOST} &
curl --retry 10 --retry-connrefused --retry-max-time 60 ${URL}/index.html
sphinx-build -b html docs/ docs/_build/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/demo.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
run: python docs/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
uses: actions/upload-artifact@v2
- name: Audit with Lighthouse
uses: treosh/lighthouse-ci-action@v8
with:
name: Pa11y and Lighthouse ${{ github.run_number }}
path: |
/tmp/pa11y
/tmp/lighthouse
if: always()
configPath: ".github/workflows/lighthouserc.json"
temporaryPublicStorage: true
uploadArtifacts: true

publish:
name: Publish to PyPI
Expand Down