Skip to content

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

Merged
balat merged 1 commit into
masterfrom
ci/cache-opam-switch
Jun 30, 2026
Merged

ci(doc): cache the opam switch to skip recompiling the dependency tree#306
balat merged 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 takes ~5 min per push, of which ~4.5 min is Install dependencies — recompiling the dependency tree plus wodoc and odoc from source every time. setup-ocaml@v3 only caches the base switch (the compiler).

Step Duration
Set up OCaml ~20 s
Install dependencies 4 min 23 s
Build documentation (dev) ~2 s

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; ocsigenserver itself is still rebuilt from the checkout by dune build @doc in the next step, so the docs stay current. The cache rebuilds once when an *.opam file 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.

Doc-CI pilot for the API-project pattern. Once confirmed it rolls out to toolkit, start, tyxml, i18n, ocsipersist, lwt, reactiveData (eliom too, once its unrelated wasm_of_ocaml build breakage is fixed).

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.
@balat balat merged commit 8f25ed6 into master Jun 30, 2026
11 checks passed
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