Skip to content

Commit 0f87c3a

Browse files
committed
fix: use setup-gradle for Gradle caching in CI
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.
1 parent 469e167 commit 0f87c3a

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

.github/actions/common-setup/action.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,11 @@ runs:
1313
shell: bash
1414
run: chmod +x gradlew
1515

16-
- name: Cache Gradle Wrapper
17-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 #v5.0.3
18-
with:
19-
path: |
20-
~/.gradle/wrapper
21-
!~/.gradle/wrapper/dists/**/gradle*.zip
22-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
23-
restore-keys: |
24-
${{ runner.os }}-gradle-wrapper-
25-
26-
- name: Cache Gradle Dependencies
27-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 #v5.0.3
28-
with:
29-
path: |
30-
~/.gradle/caches
31-
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/**/*.kt') }}
32-
restore-keys: |
33-
${{ runner.os }}-gradle-caches-
16+
# Use gradle/actions/setup-gradle for caching: it resolves GRADLE_USER_HOME
17+
# correctly whether the job runs on the host runner (~ = /home/runner) or
18+
# inside a container job (~ = /root), and produces a sane cache key from
19+
# the Gradle build files. The previous manual actions/cache step targeted
20+
# ~/.gradle/{wrapper,caches} which doesn't exist in container jobs and
21+
# emitted "Path Validation Error" warnings — so caches were never saved.
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e #v6.1.0

0 commit comments

Comments
 (0)