Open hfhbd opened 1 year ago
Thanks for the report. To make this work, we'd need to do the following:
RUNNER_OS
value at the lowest level. This would have to be removed for non-shareable caches. Perhaps it could be removed in general since OS entries are implicitly separate without enableCrossOsArchive
.enableCrossOsArchive: true
on these calls to save and restore the cache.PRs welcome!
I took a look and found another snag: since the paths to Gradle User Home are different on Linux vs Windows, just passing enableCrossOsArchive: true
when saving and restoring isn't enough. Any files to be shared would need to be first moved to an OS agnostic location before calling saveCache
or restoreCache
. Without this, the entry pattern
values are different, and the entries won't be shared.
Given that with the latest version we also take the arch as key and not all dependencies/caches (like Kotlin MPP) supports multi OS out of the box, I think we can close this issue.
I think this might still be useful for entries extracted from Gradle User Home. For example, we extract the dependency jars into a separate entry that can be reused even as other parts of Gradle User Home change.
Some of these extracted entries are not inherently tied to OS/arch and should/could be reusable between different OSes.
GitHub Actions/Cache supports enableCrossOsArchive to reuse the same cache from different operating systems. This is very handy for matrix builds using multiple OS to further reduce the CI time (and costs).
https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache