graalvm / setup-graalvm

GitHub Action for setting up GraalVM distributions.
https://www.graalvm.org
Universal Permissive License v1.0
192 stars 27 forks source link

support caching of package dependencies #11

Closed pjfanning closed 2 years ago

pjfanning commented 2 years ago

Would it be possible to support a cache feature like this one?

https://github.com/actions/setup-java#caching-packages-dependencies

setup-graalvm would often be used alongside setup-java and it would be nice to have the 2 actions maintain similar capabilities.

fniephaus commented 2 years ago

Would it be possible to support a cache feature like this one?

Hi @pjfanning, yes I think we should be able to support that.

setup-graalvm would often be used alongside setup-java and it would be nice to have the 2 actions maintain similar capabilities.

Can the caching provided by setup-java be shared with setup-graalvm if both are used at the same time? If setup-graalvm supports something similar, I wonder if this could cause caches to be created twice.

pjfanning commented 2 years ago

@fniephaus I guess the driving use case would be for use cases where someone only uses setup-graalvm (and maybe used setup-java before but changed over to setup-graalvm).

For users who use both, they could choose to set the cache param on just on of the 2. The documentation could mention this.

fniephaus commented 2 years ago

Yes, that sounds good. It seems we could re-use the cache.ts from the setup-java action, but I am not sure if the licenses allow that. I will need to look into this.

fniephaus commented 2 years ago

I think we should be able to "fork" the cache.ts if we add the original license to its header. Would you be interested in contributing this, @pjfanning?

pjfanning commented 2 years ago

@fniephaus I've never been involved in writing Github Actions. I'll need some pointers. The first issue I hit was with cache.ts and the imports of '@actions/cache' and '@actions/glob' - I'm not sure how actions-java gets this to work. I'm getting a CI issue - https://github.com/pjfanning/setup-graalvm/runs/6926051352?check_suite_focus=true

fniephaus commented 2 years ago

I think you'll need to add @actions/cache and @actions/glob as dependencies: https://github.com/actions/toolkit/tree/master (npm install --save ... I think). Also note that you'll have to regenerate the files under dist/ via npm run build and check in the generated files.

fniephaus commented 2 years ago

You'll also need to touch the action.yml and add the new option.

fniephaus commented 2 years ago

We've just implemented dependency caching a la actions/setup-java. Could you please take this for a spin, @pjfanning?