Skip to content

ci: persist Gradle configuration cache across CI runs - #62

Merged
OmarAlJarrah merged 3 commits into
mainfrom
ci/cache-gradle-configuration-cache
Jul 13, 2026
Merged

ci: persist Gradle configuration cache across CI runs#62
OmarAlJarrah merged 3 commits into
mainfrom
ci/cache-gradle-configuration-cache

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

  • Gradle's configuration cache lives in the checkout (.gradle/configuration-cache), not GRADLE_USER_HOME, so gradle/actions/setup-gradle never persists it — every job pays full task-graph calculation on every run, regardless of the existing toolchain caching.
  • A configuration-cache entry depends only on build scripts/properties, not application sources, so seeding it from main should get hits even on PRs that only change .kt files.
  • Adds actions/cache restore/save steps for .gradle/configuration-cache to static-analysis, web, and all three native matrix legs, following the existing ~/.konan toolchain-cache convention: restore on every branch, write only from main on a non-exact hit so PR runs can't evict the warm cache.

Test plan

  • YAML validated (python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))")
  • CI green on this PR
  • A follow-up run on main (or a subsequent PR) confirms cache hits — no "Calculating task graph as no cached configuration is available for tasks" in the logs

Gradle's configuration cache is stored in the checkout (.gradle/configuration-cache),
not GRADLE_USER_HOME, so setup-gradle's default caching never covers it and every job
recalculates the task graph from scratch on every run. Cache that directory the same
way the Kotlin/Native toolchain cache already is: restored on every branch, written
only from main on a non-exact hit so PR runs can't evict the warm cache.
The configuration-cache save/restore steps run silently, so confirming
they actually produce a hit means digging through raw --stacktrace
logs by hand. Pipe each Gradle invocation through tee and grep for
Gradle's own "Reusing configuration cache" / "Calculating task graph"
line into the job summary, so cache effectiveness is visible on every
run instead of a one-off manual check.
v6 has no input/output changes from v4 (path, key, restore-keys,
cache-hit — all identical); the only substantive change across v4 to
v6 is the Node24 runtime, which GitHub-hosted runners already default
to. Picks up the ESM migration and read-only cache access handling
from v6.1.0.
@OmarAlJarrah
OmarAlJarrah merged commit 7bd573f into main Jul 13, 2026
9 of 10 checks passed
@OmarAlJarrah
OmarAlJarrah deleted the ci/cache-gradle-configuration-cache branch July 13, 2026 11:55
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