Repository navigation
feat: setup-gradle and setup-graalvm keep the configuration cache between the runs of a job - #65
Merged
Merged
Conversation
…ween the runs of a job setup-gradle restores the configuration cache only on an exact match of the Gradle User Home cache, whose key holds the commit: a new commit never reuses it. The configuration cache directory is now restored from the latest entry of the same job, and written like the Gradle cache (on the default branch only). Gradle reuses an entry only when the fingerprint of its inputs is unchanged. Opt out with configuration-cache: 'false'.
…e steps in an action
|
Member
Author
|
Checked in Litote/motis-mcp-app#244 (closed): run 46643887282 saved the entry, run 46644396967 on the next commit restored it and logged |
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.



Why
gradle/actions/setup-gradlerestores the configuration cache only when the Gradle User Home cache matches its key exactly. That key holds the commit SHA, so a new commit always gets a restore-key hit, and the configuration cache is never reused: every CI run logsCalculating task graph as no cached configuration is available for tasks: …, on pull requests and on the default branch alike (seen in motis-mcp-app).What
When
cache-encryption-keyis given (the entries are encrypted with it, so it must stay the same from run to run),setup-gradleandsetup-graalvmnow cache.gradle/configuration-cache:gradle-configuration-cache-v1|<os>-<arch>|<workflow>|<job>|java-<version>|<sha>, restored from the latest entry with the same prefix;actions/cachewhencache-read-onlyis not'true'(default branch), withactions/cache/restoreotherwise (pull requests);configuration-cache,'true'by default, to opt out.Gradle reuses a restored entry only when the fingerprint of the configuration inputs (build scripts, files and environment read at configuration time) is unchanged, and computes the configuration again otherwise, so a stale entry is never used.
Limits
.gradle/configuration-cachein the working directory: a build whose root is elsewhere is not cached.ci.yml: it would need the encryption key. To check it, use the action from this branch in a repository withGRADLE_ENCRYPTION_KEY: the second commit on the default branch should logReusing configuration cache.