gradle / gradle-build-action

Execute your Gradle build and trigger dependency submission
https://github.com/marketplace/actions/gradle-build-action
MIT License
671 stars 97 forks source link

Feature request: Allow to switch cache provider #752

Closed gmazzo closed 1 year ago

gmazzo commented 1 year ago

Hi there, we were recently exploring this action and noted it's coupled with GitHub's Cache API. Could you consider opening to work with another cache provider instead?

We are initially targeting S3, like this other actions/cache drop-in replacement. But having the ability to specify the handler will be ideal. On top of my mind, I was thinking something like:

cache-provider: github # default
cache-provider: s3://xxx
cache-provider: https://xxx.yyy/zzz?${key}=${value}
bigdaz commented 1 year ago

I'm going to close this as it's unlikely we'll be working on such a feature in the foreseeable future. The GitHub Actions cache has some unique behaviour that will make it more challenging to implement other cache backends:

  1. Cache entries from different git branches are isolated. Only cache entries save by the same branch or a base branch. See here for more details: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
  2. Cache entries are restored based on partial match of keys. So you can supply a restore key like foo-bar and it will match an entry saved with key foo-bar-1234. The gradle-build-action relies on this functionality to restore the Gradle User Home for a prior workflow run.