fix error #2
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
name: continuous-integration | |
# README | |
# ====== | |
# | |
# All the jobs are defined with `matrix` for OS and Python version, even if we | |
# only run them on one combination of OS/Python. The reason for this is you get | |
# a nice side-effect that the OS and Python version of the job are listed in | |
# parentheses next to the job name in the Actions UI. | |
# This prevents workflows from being run twice on PRs | |
# ref: https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_call: | |
env: | |
COVERAGE_THRESHOLD: 60 | |
jobs: | |
lint: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- uses: pre-commit/[email protected] | |
# Build our site on the 3 major OSes and check for Sphinx warnings | |
build-site: | |
needs: [lint] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
python -m pip install -e .[doc] | |
- name: Show installed versions | |
run: python -m pip list | |
- name: Build docs | |
run: sphinx-build -b html docs/ docs/_build/html --keep-going -w warnings.txt | |
- name: Check for unexpected Sphinx warnings | |
run: python tests/utils/check_warnings.py | |
# Run local Lighthouse audit against built site | |
audit: | |
needs: [build-site] | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
python -m pip install -e .[doc] | |
- name: Show installed versions | |
run: python -m pip list | |
# We want to run the audit on a simplified documentation build so that | |
# the audit results aren't affected by non-theme things like extensions. | |
# Here we copy over just the kitchen sink into an empty docs site with | |
# only the theme loaded so extensions don't play a role in audit scores. | |
- name: Copy kitchen sink to a tiny site and build it | |
run: | | |
mkdir audit/ | |
mkdir audit/site | |
cp -r docs/examples/kitchen-sink audit/site/kitchen-sink | |
printf "Test\n====\n\n.. toctree::\n\n kitchen-sink/index\n" > audit/site/index.rst | |
echo 'html_theme = "pydata_sphinx_theme"' > audit/site/conf.py | |
echo '.. toctree::\n :glob:\n\n *' >> audit/site/index.rst | |
sphinx-build audit/site audit/_build | |
# The lighthouse audit runs directly on the HTML files, no serving needed | |
- name: Audit with Lighthouse | |
uses: treosh/lighthouse-ci-action@v10 | |
with: | |
configPath: ".github/workflows/lighthouserc.json" | |
runs: 1 # Multiple runs to reduce variance | |
# LHCI server | |
serverBaseUrl: ${{ secrets.LHCI_SERVER_BASE_URL }} | |
serverToken: ${{ secrets.LHCI_SERVER_TOKEN }} |