ci(docs): cache the gallery execution stamps, and publish a PR docs artifact - #337
Merged
Merged
Conversation
pellet
marked this pull request as draft
September 1, 2026 12:10
pellet
force-pushed
the
fix/docs-ci-cache-and-preview
branch
from
September 1, 2026 12:22
96ef0f4 to
2cab680
Compare
pellet
force-pushed
the
fix/docs-ci-cache-and-preview
branch
from
September 3, 2026 12:34
312ec77 to
682e3c1
Compare
pellet
force-pushed
the
fix/docs-ci-cache-and-preview
branch
from
September 27, 2026 08:42
452992b to
00f899c
Compare
…rtifact The cache stores `doc/_build/html`, which does not make a docs build cheaper. sphinx-gallery skips an example only when `<example>.py.md5` sits beside its generated rst in `doc/auto_examples`, and Sphinx tracks staleness in `doc/_build/doctrees`. The current cache holds neither directory, so every example re-executes on every run. On master push [33301489918](https://github.com/NeuroTechX/EEG-ExPy/actions/runs/33301489918/attempts/1) the cache hit, yet the examples still took 155 s to execute in total. Cache those two directories instead, so unchanged examples are skipped. Locally, a build drops from 145 s (every run today) to 28 s when no example changed. The key has two parts because each example's md5 covers only that example's file, so it is not affected by changes to the library, docs sources or docs environment. The prefix hashes `eegnb/**`, `doc/**`, the docs environment, `requirements.txt` and `setup.py`; the examples hash follows. A `restore-keys` fallback therefore only matches an entry built with the same prefix: an examples-only PR reuses the other examples' output, and a change to any file in the prefix triggers a full rebuild. Also adds `upload-artifact`, so reviewers can download a PR's rendered docs; `docs.yml` otherwise only publishes on push to `master`. The `master` deploy is unchanged. Related: NeuroTechX#322 (draft) also adds an artifact step and deploys a live preview to `gh-pages/pr-preview/`. That push needs a write token, which fork `pull_request` runs don't get, so the artifact is the part that works everywhere.
pellet
force-pushed
the
fix/docs-ci-cache-and-preview
branch
from
September 29, 2026 13:37
00f899c to
8e2d1db
Compare
pellet
marked this pull request as ready for review
September 30, 2026 21:51
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cache stores
doc/_build/html, which does not make a docs build cheaper. sphinx-gallery skips an example only when<example>.py.md5sits beside its generated rst indoc/auto_examples, and Sphinx tracks staleness indoc/_build/doctrees. The current cache holds neither directory, so every example re-executes on every run. On master push 33301489918 the cache hit, yet the examples still took 155 s to execute in total.Cache those two directories instead, so unchanged examples are skipped. Locally, a build drops from 145 s (every run today) to 28 s when no example changed.
The key has two parts because each example's md5 covers only that example's file, so it is not affected by changes to the library, docs sources or docs environment. The prefix hashes
eegnb/**,doc/**, the docs environment,requirements.txtandsetup.py; the examples hash follows. Arestore-keysfallback therefore only matches an entry built with the same prefix: an examples-only PR reuses the other examples' output, and a change to any file in the prefix triggers a full rebuild.Also adds
upload-artifact, so reviewers can download a PR's rendered docs;docs.ymlotherwise only publishes on push tomaster. Themasterdeploy is unchanged.Related: #322 (draft) also adds an artifact step and deploys a live preview to
gh-pages/pr-preview/. That push needs a write token, which forkpull_requestruns don't get, so the artifact is the part that works everywhere.