Skip to content
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

Smarter caching in CI #268

Closed
armanbilge opened this issue May 2, 2022 · 6 comments · Fixed by #300
Closed

Smarter caching in CI #268

armanbilge opened this issue May 2, 2022 · 6 comments · Fixed by #300
Milestone

Comments

@armanbilge
Copy link
Member

armanbilge commented May 2, 2022

Two Three things to consider:

  • cache all deps, not just sbt deps
  • be robust to different ci jobs that may download different deps (e.g., jvm vs js vs scalafix vs site)
  • don't get invalidated by simple changes tobuild.sbt etc.
@armanbilge
Copy link
Member Author

One idea to fix might be to determine the cache key not just from the build configuration, but also from the matrix. Effectively each job in the matrix would get its own cache.

GH actions supports caches of up to 10 GB before it starts evicting old caches. If each job gets its own cache this could add up real quick, at which point it would be useless.

@DavidGregory084
Copy link
Member

GH actions supports caches of up to 10 GB before it starts evicting old caches. If each job gets its own cache this could add up real quick, at which point it would be useless.

Perhaps this could be mitigated by using restore keys, provided the keys were prefixed in a way that allowed the cache to be layered nicely

@armanbilge
Copy link
Member Author

That's a good point. I'd say if we can get sbt and plugins out of the cache then it's a win. Library deps are icing on the cake :)

@armanbilge
Copy link
Member Author

Seems we may be caching some files we are not supposed to, like *.lock and ivydata-*.properties. This should be fixed as well.
https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html#Caching

@armanbilge
Copy link
Member Author

The setup-java action now supports caching. I think we should just use that and call it a day.

@armanbilge armanbilge added this to the v0.5.0 milestone Oct 8, 2022
@armanbilge
Copy link
Member Author

See also some discussion about why the "smarter caching" proposal that was originally the goal of this issue, actually would not work. tl;dr if you use the restore key to fallback to a non-exact-match cache, then when you create a new cache it will also include unnecessary stuff from the fallback cache. This causes your cache to grow unboundedly.

@armanbilge armanbilge linked a pull request Oct 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants