Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Merged
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
55 changes: 55 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Builds the documentation site with --strict, so a broken link, a page missing from the
# nav or a bad include fails the pull request that caused it. Documentation changes do not
# start the test matrix (test-python-bindings.yml runs when code changes), and this is the
# check that covers them. It does not run the code blocks in the pages: tests/test_docs_examples.py
# does, needs the built wheel, and runs in the release workflow; see "Documentation Development".
#
# Fork-only: upstream has no such site, so this is absent from make-upstream-pr-branch.sh's
# INCLUDE_PATHS and present in sync-upstream.sh's FORK_GITHUB_ALLOWLIST.
name: Docs Build

on:
pull_request:
paths:
- 'bindings/python/docs/**'
- 'bindings/python/mkdocs.yml'
- '.github/workflows/docs-build.yml'
push:
branches:
- main
paths:
- 'bindings/python/docs/**'
- 'bindings/python/mkdocs.yml'
- '.github/workflows/docs-build.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
name: mkdocs build --strict
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # the git-revision-date plugin reads each page's history

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"

# Pinned to the versions the site was last built with, so a new release of the theme
# cannot turn a pull request red for a reason that is not in the pull request.
- name: Install documentation tools
run: python -m pip install "mkdocs==1.6.1" "mkdocs-material==9.7.7" "mkdocs-git-revision-date-localized-plugin==1.6.0" "mkdocs-macros-plugin==1.5.0"

- name: Build the site (warnings are errors)
working-directory: bindings/python
run: python -m mkdocs build --strict -f mkdocs.yml
37 changes: 37 additions & 0 deletions .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,40 @@ jobs:
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: --files $(git ls-files 'bindings/python/**')

# The test workflows list what triggers them (an allowlist), so a new tracked top-level entry
# under bindings/python would silently not start CI unless someone decides about it. This job
# makes that decision a failure: every entry is either covered by both workflows' path lists or
# named below as documentation/metadata that needs no test run.
ci-trigger-coverage:
name: CI triggers cover every bindings/python entry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check the trigger paths against the tracked entries
run: |
python3 -m pip install --quiet "pyyaml==6.0.3"
python3 - <<'PY'
import subprocess, sys, yaml
# Entries that never need the test matrix. Documentation is built by docs-build.yml.
NO_TEST_RUN = {".gitignore", "AGENTS.md", "CLAUDE.md", "README.md", "docs", "mkdocs.yml"}
WORKFLOWS = ["test-python-bindings.yml", "test-python-examples.yml"]
files = subprocess.check_output(["git", "ls-files", "bindings/python"], text=True).split("\n")
entries = {f.split("/")[2] for f in files if f.count("/") >= 2}
problems = []
for wf in WORKFLOWS:
on = yaml.safe_load(open(".github/workflows/" + wf))[True]
for event in ("pull_request", "push"):
paths = [p for p in on[event]["paths"] if not p.startswith("!")]
for e in sorted(entries):
base = "bindings/python/" + e
covered = any(p == base or p.startswith(base + "/") for p in paths)
if covered and e in NO_TEST_RUN:
problems.append(f"{wf} {event}: {e} triggers the matrix but is listed as needing no test run")
if not covered and e not in NO_TEST_RUN:
problems.append(f"{wf} {event}: new entry bindings/python/{e} is not in the trigger paths; add it there, or to NO_TEST_RUN in lint-workflows.yml if it needs no test run")
if problems:
print("\n".join(problems))
sys.exit(1)
print("every tracked bindings/python entry is decided:", ", ".join(sorted(entries)))
PY
23 changes: 21 additions & 2 deletions .github/workflows/test-python-bindings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test Python Bindings

# The matrix runs when code changes: the same surface the upstream pull-request branch ships (src, tests, examples, scripts, pyproject.toml, setup.py).
# Documentation, READMEs and agent files do not start it; see "Documentation Development" for what to run by hand, and the release workflow runs everything.
on:
# Run on push to bindings/python/ directory, on main only: the upstream-main
# mirror branch that sync-upstream.sh maintains (locally; the script does not
Expand All @@ -9,13 +11,23 @@ on:
branches:
- main
paths:
- 'bindings/python/**'
- 'bindings/python/src/**'
- 'bindings/python/tests/**'
- 'bindings/python/examples/**'
- 'bindings/python/scripts/**'
- 'bindings/python/pyproject.toml'
- 'bindings/python/setup.py'
- '.github/workflows/test-python-bindings.yml'

# Run on pull request affecting bindings/python/
pull_request:
paths:
- 'bindings/python/**'
- 'bindings/python/src/**'
- 'bindings/python/tests/**'
- 'bindings/python/examples/**'
- 'bindings/python/scripts/**'
- 'bindings/python/pyproject.toml'
- 'bindings/python/setup.py'
- '.github/workflows/test-python-bindings.yml'

# Allow being called by other workflows (e.g., release workflow)
Expand All @@ -40,6 +52,13 @@ on:
type: boolean
default: false

# A newer push to a pull request supersedes the run of the commit before it: without this each push starts another
# full matrix next to the one still running. Scoped to pull_request only, so a push to main keeps its run as the
# record for that commit (same rule as test-python-examples.yml).
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/test-python-examples.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test Python Examples

# The matrix runs when code changes: the same surface the upstream pull-request branch ships (src, tests, examples, scripts, pyproject.toml, setup.py).
# Documentation, READMEs and agent files do not start it; see "Documentation Development" for what to run by hand, and the release workflow runs everything.
on:
# Run on push to bindings/python/ directory, on main only: the upstream-main
# mirror branch that sync-upstream.sh pushes is upstream's tree without our
Expand All @@ -8,13 +10,23 @@ on:
branches:
- main
paths:
- 'bindings/python/**'
- 'bindings/python/src/**'
- 'bindings/python/tests/**'
- 'bindings/python/examples/**'
- 'bindings/python/scripts/**'
- 'bindings/python/pyproject.toml'
- 'bindings/python/setup.py'
- '.github/workflows/test-python-examples.yml'

# Run on pull request affecting bindings/python/
pull_request:
paths:
- 'bindings/python/**'
- 'bindings/python/src/**'
- 'bindings/python/tests/**'
- 'bindings/python/examples/**'
- 'bindings/python/scripts/**'
- 'bindings/python/pyproject.toml'
- 'bindings/python/setup.py'
- '.github/workflows/test-python-examples.yml'

# Allow being called by other workflows (e.g., release workflow)
Expand Down
4 changes: 4 additions & 0 deletions bindings/python/docs/development/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ a link to a missing heading only at `info` level (`validation.links.anchors`), s
link with an anchor in the built site, or build once with a temporary config that sets
`validation: {links: {anchors: warn}}`.

A documentation-only pull request does not start the test workflows (they run when `src`, `tests`, `examples`, `scripts`, `pyproject.toml` or `setup.py` change). The `Docs Build` workflow runs the strict build above for it. It does not run the code blocks in the pages: `uv run pytest bindings/python/tests/test_docs_examples.py` does, so run it yourself before pushing a change to a code block. The release workflow runs the whole suite, so a page that drifts cannot ship.

When a new tracked file or directory appears directly under `bindings/python`, the `CI triggers cover every bindings/python entry` check in `lint-workflows.yml` fails until it is either added to the trigger paths of both test workflows or listed there as needing no test run.

## Versioned Documentation

Documentation is versioned using [mike](https://github.com/jimporter/mike) and automatically deployed when you push a version tag.
Expand Down
1 change: 1 addition & 0 deletions sync-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ FORK_GITHUB_ALLOWLIST=(
# Fork-only: upstream runs the same SHA-pin check in mvn-test.yml, so this
# is deliberately NOT in make-upstream-pr-branch.sh's INCLUDE_PATHS.
".github/workflows/lint-workflows.yml"
".github/workflows/docs-build.yml" # ours; not upstream (strict docs build for documentation-only changes)
)

PROTECTED_SOURCE_REV=""
Expand Down
Loading