Skip to content

Cache readonly - #25

Open
mbarbin wants to merge 2 commits into
ocaml-dune:mainfrom
mbarbin:cache-readonly
Open

Cache readonly#25
mbarbin wants to merge 2 commits into
ocaml-dune:mainfrom
mbarbin:cache-readonly

Conversation

@mbarbin

@mbarbin mbarbin commented Feb 9, 2026

Copy link
Copy Markdown
Contributor
  • Add a new input to use the cache in a read-only fashion.
  • Simplify handling of the README to support ongoing development
  • Enable the cache-readonly repo in the CI of this repo when not on the main branch (applicable to PRs).

@mbarbin

mbarbin commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #23

@shym shym left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only had a quick look at it but it looks pretty nice, thank you for that!
Seeing the mostly-duplication of the actions/cache code had me thinking: as we have to duplicate it, might this be an opportunity to really use the separate actions/cache/restore and actions/cache/save and use that to provide the possibility to save the cache even in case of failure (using if: always() && ...). Instead of cache-readonly, maybe we could have a save-cache input ranging over onsuccess, always, and never, say. What do you think?

@mbarbin

mbarbin commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

Thank for you having a first look!

To help us support that discussion I pushed another few commits to that exploratory branch if you wanna have a look too:

https://github.com/mbarbin/setup-dune/tree/cache-readonly.exploratory

Re: onsuccess vs always I am not really sure. I have been in that boat of attending a long build (actually last week or something), and then a small error at the end occurs, and the next build will go from scratch.. So I hear you! That being said, with a maintainer hat, I would find it easier if there wasn't many toggles. Maybe we can make an opinionated decision and choose that strategy, and let users delete their caches if they're unhappy?

@mbarbin

mbarbin commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

Ah, I was just reminded of a thought I had during testing of the first version: with the actions/cache the save is deferred at the end of the workflow, which may include additional step the user is performing after loading and executing setup-dune (which I do in some repos) versus with the explicit save, the save is done as part of the setup-dune workflow (not at the end). Not exactly sure how this matters, but I had forgotten about this difference when writing the follow up exploratory changes and that specific difference might not be in favor of the explicit save (I'd have to think more about this). Just an additional data point for us to consider!

@mbarbin

mbarbin commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

I just rebased it to pick up the root README simplification.

Having used this change for a few weeks now, I think it is a good direction for the project. Looking back at the additional exploratory changes, I don't feel there is enough evidence supporting how useful they would be, compared to the deferred save that's implemented in this version, so I'm OK with this as-is. Please let me know what you think. Thanks!

mbarbin added 2 commits March 28, 2026 16:04
This is useful e.g. for use in PRs to avoid evicting the caches saved from the
main branch.

Signed-off-by: Mathieu Barbin <mathieu.barbin@gmail.com>
This serves as a test for it, but also the reason why this input exists can
apply to this repo and bring some value to its own CI.

Signed-off-by: Mathieu Barbin <mathieu.barbin@gmail.com>
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.

2 participants