-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make better use of caching in CI #538
Conversation
- name: Update environment & write to cache | ||
run: mamba env update -n hydromt -f environment.yml | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
- name: Fail on no cache restore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean the workflow fails if there is no cache available? What would be the expected cases for when no caching is available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does, this should actually never happen, but because mamba itself is in the cache the flow would fail anyway, this is just to provide a bit of a nicer error message. In the case the cache is unavailable, it should be regenerated (which happens on a schedule)
@@ -0,0 +1,95 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we refresh our cache? To obtain new versions of packages? Because there are seperate tools for that one I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various reasons. Obtained new versions of packages, integrate new packages into the cache, make sure all the tests are running from the same cache. Because mamba solving is not stable, it's important to keep all the tests in sync by periodically refreshing the cache that they all use. Besides, the cache limit is at 10GB which we bump up against about weekly, instead of trying to do very clever cache invalidation I thought it was much more maintainable to just clean out and regenerate the cache every week, that way we make sure we keep within our limits and that everything uses the up to date versions of everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that dependabot does not do mamba / conda, so I think this is way better than nothing :)
Issue addressed
NA
Explanation
As with all purely CI PRs there sadly arent' any tests that I can show to demonstrate it works, but I've worked on an dtested it in a seperate repository that the reviewer can look at should they want: https://github.com/savente93/ci-playground. Because the dependency caches tend to be quite large, there's not enough space in the cache allowance to let each PR have it's own cache so I went with the following setup:
Checklist
main
Additional Notes (optional)
Add any additional notes or information that may be helpful.