| 1 |
# This workflow is checks that the documentation can be built across multiple OSes, |
| 2 |
# Python, and Sphinx versions. |
| 3 |
# It also checks for broken links in the documentation and runs Lighthouse audits |
| 4 |
# on the built site. |
| 5 |
# IMPORTANT: if you make changes to this workflow, you will need to open a follow-up |
| 6 |
# PR after merge to update the action SHA in the publish workflow |
| 7 |
|
| 8 |
name: docs-checks |
| 9 |
|
| 10 |
# Dynamic concurrency group that uses the workflow name and PR number if available |
| 11 |
# or commit SHA as a fallback. If a new build is triggered under that |
| 12 |
# concurrency group while a previous build is running it will be canceled. |
| 13 |
# Repeated pushes to a PR will cancel all previous builds, while multiple |
| 14 |
# merges to main will not cancel. |
| 15 |
# Note we add the prefix `docs-` to avoid race conditions when called from other workflows |
| 16 |
# for example when called from the CI workflow |
| 17 |
concurrency: |
| 18 |
group: docs-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 19 |
cancel-in-progress: true |
| 20 |
|
| 21 |
env: |
| 22 |
FORCE_COLOR: "1" # Make tools pretty |
| 23 |
DEFAULT_PYTHON_VERSION: "3.14" # keep in sync with tox.ini |
| 24 |
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Don't check for pip updates |
| 25 |
|
| 26 |
# disable all permissions by default |
| 27 |
permissions: {} |
| 28 |
|
| 29 |
on: |
| 30 |
push: |
| 31 |
branches: |
| 32 |
- main |
| 33 |
pull_request: |
| 34 |
branches: |
| 35 |
- "*" |
| 36 |
# allows this to be used as a composite action in other workflows |
| 37 |
workflow_call: |
| 38 |
# allow manual triggering of the workflow, while debugging |
| 39 |
workflow_dispatch: |
| 40 |
|
| 41 |
jobs: |
| 42 |
# Build our docs (PST) on major OSes and check for warnings |
| 43 |
build-site: |
| 44 |
name: "build PST docs" |
| 45 |
strategy: |
| 46 |
fail-fast: false |
| 47 |
matrix: |
| 48 |
os: [ubuntu-latest, macos-latest, windows-latest] |
| 49 |
python-version: ["3.14"] |
| 50 |
include: |
| 51 |
# oldest Python version with the oldest Sphinx version |
| 52 |
- os: ubuntu-latest |
| 53 |
python-version: "3.10" |
| 54 |
sphinx-version: "7.0" |
| 55 |
runs-on: ${{ matrix.os }} |
| 56 |
steps: |
| 57 |
- name: "Checkout repository 🛎" |
| 58 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 59 |
with: |
| 60 |
persist-credentials: false |
| 61 |
|
| 62 |
- name: "Setup CI environment 🛠" |
| 63 |
# Important: make sure to update the SHA after making any changes to the set-dev-env action |
| 64 |
uses: pydata/pydata-sphinx-theme/.github/actions/set-dev-env@e8db643b990df73812cf9397bc0f8cfa1164e4d3 |
| 65 |
with: |
| 66 |
python-version: ${{ matrix.python-version }} |
| 67 |
pandoc: true |
| 68 |
graphviz: true |
| 69 |
|
| 70 |
- name: "Build docs and check for warnings 📖" |
| 71 |
shell: bash |
| 72 |
run: | |
| 73 |
# check if there is a specific Sphinx version to build with |
| 74 |
# example substitution: tox run -e py310-sphinx61-docs |
| 75 |
if [ -n "${{matrix.sphinx-version}}" ]; then |
| 76 |
python -Im tox run -e py$(echo ${{ matrix.python-version }} | tr -d .)-sphinx$(echo ${{ matrix.sphinx-version }} | tr -d .)-docs |
| 77 |
# build with the default Sphinx version |
| 78 |
# example substitution: tox run -e py312-docs |
| 79 |
else |
| 80 |
python -Im tox run -e py$(echo ${{ matrix.python-version }} | tr -d .)-docs |
| 81 |
fi |
| 82 |
|
| 83 |
# Run Lighthouse audits on the built site (kitchen-sink only) |
| 84 |
lighthouse-audit: |
| 85 |
needs: build-site |
| 86 |
runs-on: ubuntu-latest |
| 87 |
steps: |
| 88 |
- name: "Checkout repository 🛎" |
| 89 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 90 |
with: |
| 91 |
persist-credentials: false |
| 92 |
|
| 93 |
- name: "Setup CI environment 🛠" |
| 94 |
# Important: make sure to update the SHA after making any changes to the set-dev-env action |
| 95 |
uses: pydata/pydata-sphinx-theme/.github/actions/set-dev-env@e8db643b990df73812cf9397bc0f8cfa1164e4d3 |
| 96 |
with: |
| 97 |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} |
| 98 |
|
| 99 |
- name: "Copy kitchen sink to a tiny site" |
| 100 |
run: | |
| 101 |
# ensuring proper scaping of the variable |
| 102 |
docs_dir="${DOCS_DIR}" |
| 103 |
mkdir -p $docs_dir/site |
| 104 |
cp -r docs/examples/kitchen-sink/* $docs_dir/site/ |
| 105 |
echo 'html_theme = "pydata_sphinx_theme"' > $docs_dir/site/conf.py |
| 106 |
|
| 107 |
# build docs without checking for warnings |
| 108 |
python -Im tox run -e docs-no-checks |
| 109 |
env: |
| 110 |
DOCS_DIR: "audit" |
| 111 |
|
| 112 |
- name: "Audit with Lighthouse 🔦" |
| 113 |
# pin to Lighthouse version 12.1.0 |
| 114 |
uses: treosh/lighthouse-ci-action@2f8dda6cf4de7d73b29853c3f29e73a01e297bd8 |
| 115 |
with: |
| 116 |
configPath: ".github/workflows/lighthouserc.json" |
| 117 |
temporaryPublicStorage: true |
| 118 |
uploadArtifacts: true |
| 119 |
runs: 3 # Multiple runs to reduce variance |