Skip to content

fix: use setup-gradle for Gradle caching in CI#28

Merged
d4rken merged 1 commit into
mainfrom
fix-gradle-cache
May 20, 2026
Merged

fix: use setup-gradle for Gradle caching in CI#28
d4rken merged 1 commit into
mainfrom
fix-gradle-cache

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented May 20, 2026

Summary

Every Run tests CI job emits:

[warning]Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

Root cause: the run-tests job in code-checks.yml runs inside container: ubuntu:24.04. The actions/cache steps in .github/actions/common-setup/action.yml target ~/.gradle/wrapper and ~/.gradle/caches, which resolve to a container-local home dir that does not match where Gradle actually writes its caches in CI. actions/cache validates 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 :check each time).

Fix

Replace the two manual actions/cache steps with a single gradle/actions/setup-gradle@v6.1.0 step. This action:

  • Auto-detects GRADLE_USER_HOME correctly on both host runners and container jobs.
  • Uses Gradle-aware cache keys (no manual hashFiles glob to maintain).
  • Is the Gradle-team-recommended approach and supersedes the older manual actions/cache pattern.

Pinned to 50e97c2cd7a37755bbfafc9c5b7cafaece252f6e (#v6.1.0), the same SHA already used by gradle-wrapper-validation.yml.

Follow-up (not in this PR)

The build also surfaces:

Consider enabling configuration cache to speed up this build

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

  • CI runs without the Path Validation Error warning
  • Second CI run on this branch reports a cache hit (gradle/actions/setup-gradle logs Restored Gradle User Home from cache)
  • All existing jobs (build-modules, build-docker-image, run-tests, regression-synthetic-replay) still pass

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.
@d4rken d4rken merged commit 0f87c3a into main May 20, 2026
5 checks passed
@d4rken d4rken deleted the fix-gradle-cache branch May 20, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant