any resources on how to best use setup-gradle gith...
# community-support
c
any resources on how to best use setup-gradle github action? a teammate setup our gradle action and it's realllllly not good. two examples, they're extracting the version number of gradle from our project, instead of just relying on the gradle wrapper... and theyre also pulling in some
cache
github action and trying to cache certain downloads from gradle there. i have 0 experience setting up github actions with a gradle+android project (i usually use bitrise) so im unsure if this sort of caching thing is just handled for free when using the official gradle step. thanks!
e
Here's my setup
Copy code
- name: Setup Gradle
      uses: gradle/actions/setup-gradle@v5
      with:
        gradle-version: wrapper
and I think
wrapper
is the default, so technically it could just be
Copy code
- name: Setup Gradle
      uses: gradle/actions/setup-gradle@v5
They set up caching for you. It's configurable; they have pretty extensive documentation in their README
c
yeah. from the looks of the docs from me it seems really straightforward. thats why im confused looking at our build pipeline.
honestly it just looks "vibe coded" lol. its like 60 lines in what looks like could be ten? and ive read the docs for like 30 minutes. currently investigating if i can run github actions locally so i dont need to submit prs etc. lol
p
If you use the wrapper, like most projects, you don’t need any additional configs. It’s really just this one liner. And don’t use any other caches, except you want to cache the build-logic too.
c
is there any docs i can point to that say something along those lines 😅 "And don’t use any other caches, except you want to cache the configuration cache too."
p
Sorry, I meant build-logic/buildSrc, not CC. CC works without build-logic/buildSrc.
c
ok. so it seems like ih have to do 0 work to get caching working.
p
Yeah, just go to the docs: General usage
t
v
The docs should also tell not to use other cache solutions like
actions/cache
or
action/setup-java
c
oh heck yeah. thanks all! im going to take another stab at this today. but indeed it looks like ill be able to bring it down from the overly complicated 60 lines of yaml
v
I would never write GHA workflows in yaml these days, but Kotlin instead :-)
c
i hate yaml. so this fits the bill! thanks
👌 1