Skip to content

ci: cache the docbuild incremental state around API generation - #208

Open
cameronfreer wants to merge 1 commit into
masterfrom
ci/docbuild-cache
Open

ci: cache the docbuild incremental state around API generation#208
cameronfreer wants to merge 1 commit into
masterfrom
ci/docbuild-cache

Conversation

@cameronfreer

Copy link
Copy Markdown
Owner

Cache the nested docbuild/.lake/build around API generation, and guard the docbuild workspace against drifting from the root.

Why. Master pushes take 45–64 minutes against 6–7 for PRs, and the gap is lake build Graphon:docs in the docbuild workspace, whose incremental state lean-action never caches (it caches the root .lake only). The same pattern in infinitary-logic cut API generation from 18:43 to 1:19 on a nearby commit.

What.

  • actions/cache/restore before lake build Graphon:docs, actions/cache/save immediately after successful generation, so a later TeX/Jekyll/Pages failure cannot discard a valid cache. Key docbuild-v1-<os>-<arch>-<hash of both toolchains, both manifests, both Lake configs>-<sha>; fallback prefix without the SHA restores the latest compatible prior state. Save only when the exact key was not already restored, using the restore step's cache-primary-key.
  • API generation also runs on workflow_dispatch (not only master pushes) so the cache can be exercised from this branch; assembly and deployment stay master-only.
  • scripts/check_docbuild_sync.py, run right after checkout: docbuild's toolchain and Mathlib must match the root's. Currently in sync.

Not included, deliberately: weekly docs split, committed lean_decls, docgen-action, exact doc-gen4 commit pin, apt caching (separate PR if wanted).

Validation plan: gh workflow run build.yml --ref ci/docbuild-cache twice (cold, then warm), then measure two or three master pushes including one touching a low module.

doc-gen4's incremental state lives in docbuild/.lake, a separate Lake
workspace from the root .lake that lean-action caches, so every master push
regenerated the API docs from scratch — nearly the whole of the 45–64 minute
master runs against 6–7 minute PR runs.

Restore docbuild/.lake/build before `lake build Graphon:docs` and save it
immediately after successful generation, keyed by format version, OS,
architecture, both toolchains, both manifests, both Lake configurations,
and the exact commit, with a dependency-compatible fallback prefix that
restores the latest compatible prior state. The save reuses the restore
step's primary key and runs only when that key was not already restored.
API generation also runs on manual dispatch so the cache can be exercised
from a branch; assembly and deployment remain master-only.

Add scripts/check_docbuild_sync.py, run right after checkout: the nested
workspace must resolve the same toolchain and Mathlib as the root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant