ci(doc): cache the opam switch to skip recompiling the dependency tree#306
Merged
Conversation
The doc job spent ~4.5 min recompiling the dependency tree plus wodoc and odoc from source on every push; setup-ocaml only caches the base switch. Cache the whole _opam switch keyed on the *.opam files and wodoc's HEAD commit, so a cache hit skips the install and only ocsigenserver itself is rebuilt by dune. The deps/wodoc rebuild once when an *.opam file or wodoc move, then re-cache.
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.
Problem
The
Documentationworkflow takes ~5 min per push, of which ~4.5 min isInstall dependencies— recompiling the dependency tree plus wodoc and odoc from source every time.setup-ocaml@v3only caches the base switch (the compiler).Fix
Cache the whole
_opamswitch withactions/cache, keyed on the*.opamfiles (the dependency set) and wodoc's resolved HEAD commit. On a cache hit the install step is skipped; ocsigenserver itself is still rebuilt from the checkout bydune build @docin the next step, so the docs stay current. The cache rebuilds once when an*.opamfile or wodoc's HEAD move.This mirrors the pilot on ocsigen.github.io (4 min → ~1 min). First run on this branch is a cache miss (populates the cache); the speed-up shows on the next run.