Skip to content

ci(doc): cache the opam switch to skip recompiling the dependency tree#1118

Open
balat wants to merge 1 commit into
masterfrom
ci/cache-opam-switch
Open

ci(doc): cache the opam switch to skip recompiling the dependency tree#1118
balat wants to merge 1 commit into
masterfrom
ci/cache-opam-switch

Conversation

@balat

@balat balat commented Jun 30, 2026

Copy link
Copy Markdown
Member

Problem

The Documentation workflow recompiles the dependency tree plus wodoc and odoc from source on every push (several minutes); setup-ocaml@v3 only caches the base switch (the compiler), so none of that was cached.

Fix

Cache the whole _opam switch with actions/cache, keyed on the *.opam files (the dependency set) and wodoc's resolved HEAD commit. On a cache hit the install step is skipped; the project itself is still rebuilt from the checkout by dune build @doc in the doc step, so the docs stay current. The cache rebuilds once when an *.opam file or wodoc's HEAD move.

Same change validated on ocsigen.github.io (4 min → ~1 min) and ocsigenserver (5 min → ~1 min, cache hit confirmed). First run on this branch is a cache miss (populates the cache); the speed-up shows on the next run.

The release job (manual, infrequent) is left as-is.

The doc job recompiled 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 the project itself is rebuilt. The deps/wodoc rebuild once
when an *.opam file or wodoc move, then re-cache.
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