ci: persist Gradle configuration cache across CI runs - #62
Merged
Conversation
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.
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
.gradle/configuration-cache), notGRADLE_USER_HOME, sogradle/actions/setup-gradlenever persists it — every job pays full task-graph calculation on every run, regardless of the existing toolchain caching.mainshould get hits even on PRs that only change.ktfiles.actions/cacherestore/save steps for.gradle/configuration-cachetostatic-analysis,web, and all threenativematrix legs, following the existing~/.konantoolchain-cache convention: restore on every branch, write only frommainon a non-exact hit so PR runs can't evict the warm cache.Test plan
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))")main(or a subsequent PR) confirms cache hits — no "Calculating task graph as no cached configuration is available for tasks" in the logs