fix: use setup-gradle for Gradle caching in CI#28
Merged
Conversation
The run-tests job runs inside a ubuntu:24.04 container, so the home-relative Gradle cache paths resolve to a container-local home that does not exist when actions/cache validates them. This produces a Path Validation Error warning every run and the cache is never persisted. Replace the two manual actions/cache steps with gradle/actions/setup-gradle, which resolves GRADLE_USER_HOME correctly on host and container runners, uses Gradle-aware cache keys, and is the upstream-recommended caching approach. Pinned to the same SHA already used by gradle-wrapper-validation.yml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every
Run testsCI job emits:Root cause: the
run-testsjob incode-checks.ymlruns insidecontainer: ubuntu:24.04. Theactions/cachesteps in.github/actions/common-setup/action.ymltarget~/.gradle/wrapperand~/.gradle/caches, which resolve to a container-local home dir that does not match where Gradle actually writes its caches in CI.actions/cachevalidates the paths at save time, finds nothing, warns, and skips the save. The Gradle cache is therefore never persisted between runs (the audit estimates ~8min added to:checkeach time).Fix
Replace the two manual
actions/cachesteps with a singlegradle/actions/setup-gradle@v6.1.0step. This action:GRADLE_USER_HOMEcorrectly on both host runners and container jobs.hashFilesglob to maintain).actions/cachepattern.Pinned to
50e97c2cd7a37755bbfafc9c5b7cafaece252f6e(#v6.1.0), the same SHA already used bygradle-wrapper-validation.yml.Follow-up (not in this PR)
The build also surfaces:
That requires Gradle code changes to verify all tasks are config-cache compatible, so it's out of scope here. Tracked as a separate follow-up.
Test plan
Path Validation Errorwarninggradle/actions/setup-gradlelogsRestored Gradle User Home from cache)build-modules,build-docker-image,run-tests,regression-synthetic-replay) still pass