Skip to content

ci: key opam cache on resolved pins, skip setup-ocaml on warm switch - #26

Merged
tiensonqin merged 3 commits into
mainfrom
devin/1790881361-ci-opam-cache-key
Oct 1, 2026
Merged

tiensonqin merged 3 commits into
mainfrom
devin/1790881361-ci-opam-cache-key

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Summary

Fixes the opam switch cache never actually helping: Install OCaml dependencies took ~2m on every run even with a cache hit.

Root cause: the ~/.opam cache key only covered hashFiles('*.opam'), but all pin-depends float on #main. Once a cache entry exists it's immutable and the save step is skipped on hits, so after any pinned repo (melange-edn, melange-transit, persistent-sorted-set-ocaml, lg) moved, every run restored a stale switch, opam install rebuilt the moved pins, and the rebuild was never re-cached — permanently.

Changes:

  • New Resolve pinned dependency commits step git ls-remotes every git+...#ref in *.opam and folds the resulting sha into the opam cache key (...-opam-${hashFiles('*.opam')}-${pins-sha}). A pin bump now produces a new key: partial restore via restore-keys → opam install rebuilds only the moved pins → saved under the new key.
  • Any restore (exact or fallback) now skips ocaml/setup-ocaml entirely and just downloads the opam binary (same pattern as logseq/chat CI) — removes the unconditional opam update that cost ~1m40s in Set up OCaml on hits.
  • Install OCaml dependencies retries with opam update on failure so a stale repo snapshot in a restored root can't permanently break resolution of newly released versions.
  • dune-cache: true moved off setup-ocaml (which no longer runs on hits) to an explicit ~/.cache/dune restore/save with branch-scoped keys plus ~/.config/dune (cache enabled), as in logseq/lg and logseq/chat.

Link to Devin session: https://app.devin.ai/sessions/ae36c1d0df314d38abdca045e69e3708
Open in Devin Desktop: https://app.devin.ai/desktop/session/ae36c1d0df314d38abdca045e69e3708?variant=devin
Requested by: @tiensonqin

@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@tiensonqin
tiensonqin merged commit 5ac4605 into main Oct 1, 2026
1 check passed
@tiensonqin
tiensonqin deleted the devin/1790881361-ci-opam-cache-key branch October 1, 2026 19:22
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