Closed ctrueden closed 2 years ago
Will this affect the other IMCF Fiji projects as well?
@ehrenfeu Other repositories with similar CI configuration would also benefit from this change, yeah. This one (and many others) was not caching the ~/.m2/repository
correctly, so every time the CI ran, it would redownload the dependency JARs. In another repository where I tested, this change improved build times from 2 min 3 sec before, to 48 sec after, so the caching makes a big difference.
The reason the cache is wrong is because it's not using hashFiles
to make a unique key per dependency configuration. Personally, I find it difficult to understand GitHub Actions caching and get it right by hand, and I suspect I'm not alone since I've seen this erroneous caching configuration copy-pasted cargo-cult style in various places around the web. Fortunately, starting with v2, the setup-java action has a cache:
parameter that can be set to maven
to make it do the caching correctly automatically without needing to use the cache
action anymore, which is what this PR changed.
TL;DR: Yes, change your other Maven-based builds to use cache: maven
in the setup-java
, and remove any cache
action that was trying to handle ~/.m2
by hand.
@ehrenfeu @lguerard It looks like this change got force-pushed away from the master branch? Was there some problem with it? As things stand, I think the caching is broken again...
Sorry about this, I must have messed it up somehow. This should now be fixed in 8087d0cab8d93788c31a24efec796814eae06f0a.
I'm working on a script right now and will make a new release as soon as I have it ready, hope that's ok with you.
Edit : Actually 16fd3f.
Thanks @ctrueden!
Will this affect the other IMCF Fiji projects as well?