ci(android): cache Gradle to stop wrapper-download flakes (#226)

The android-test job ran ./gradlew with no Gradle caching, so every run
re-downloaded the full Gradle distribution (gradle-8.5-bin.zip, ~130MB) from
services.gradle.org. A transient "Connection reset" mid-download failed the job
before any test ran (stack bottomed out in org.gradle.wrapper.Install.forceFetch)
— e.g. run 30063222009 on the npm-audit-fix PR, which passed on a plain re-run.

Add `cache: gradle` to the existing setup-java step. It caches ~/.gradle/caches
and ~/.gradle/wrapper; the wrapper cache holds the distribution zip, so cache-hit
runs skip the download entirely — removing the network dependency that flaked.
Also speeds the job up (build cache reuse).

Residual: a cold cache (first run per key, or a gradle-wrapper.properties change)
still downloads once. If that proves flaky too, a download retry can be layered on,
but caching turns "download every run" into "download rarely".

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
screentinker 2026-07-23 22:24:21 -05:00 committed by GitHub
parent 7b4e5bf416
commit eb794cefbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,6 +63,12 @@ jobs:
with: with:
distribution: temurin distribution: temurin
java-version: '17' java-version: '17'
# Cache ~/.gradle/caches AND ~/.gradle/wrapper. The wrapper cache holds the
# Gradle distribution (gradle-8.5-bin.zip); without it every run re-downloaded
# ~130MB from services.gradle.org, and a transient reset there failed the job
# before any test ran (org.gradle.wrapper.Install.forceFetch). On a cache hit the
# distribution is already present, so the download — and its flake — is skipped.
cache: gradle
- uses: android-actions/setup-android@v3 - uses: android-actions/setup-android@v3
# ScheduleEvalTest reads the SHARED shared/schedule-vectors.json (wired via # ScheduleEvalTest reads the SHARED shared/schedule-vectors.json (wired via
# the test task in app/build.gradle.kts), so a ScheduleEval.kt change that # the test task in app/build.gradle.kts), so a ScheduleEval.kt change that