CI: keep the Maven cache warm so builds stop re-downloading Central - #67
Merged
Conversation
The repo often goes quiet for longer than the 7-day Actions cache eviction window, so every build started cold and re-downloaded the full dependency tree. Add a twice-weekly cache-warmer job to keep the cache alive, drop the redundant second cache step (setup-java's cache:maven already covers ~/.m2/repository), parallelise artifact downloads for the cold case, and allow manual builds via workflow_dispatch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for orbital-nebula canceled.
|
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.
Problem
Nearly every CI run spends minutes re-downloading the full dependency tree from Maven Central, despite cache configuration being present.
Root cause: GitHub evicts any Actions cache not accessed for 7 days, and this repo regularly goes quiet for longer than that — the repo currently has zero stored caches. Every build therefore starts cold. There was also redundant double-caching:
setup-javawithcache: mavenalready caches~/.m2/repository, but a secondactions/cachestep cached all of~/.m2on top of it.Changes
warm-maven-cache.yml: a twice-weekly (Mon + Thu) scheduled job runningmvn dependency:go-offlinewith the same cache config. On a hit it's a cheap no-op that resets the 7-day eviction clock; when poms change it rebuilds the cache. Real builds then restore a warm cache instead of downloading from Central.build.yml: dropped the redundantactions/cachestep; added-Dmaven.artifact.threads=16(default 5) so cold downloads run faster, and-B -ntpto reduce log noise; addedworkflow_dispatchso a build (and:nextimage publish, when run onmain) can be kicked manually.Caveat
GitHub auto-disables scheduled workflows after 60 days without repo activity — if the repo has been dormant that long, re-enable the warmer from the Actions tab (noted in a comment in the workflow).
🤖 Generated with Claude Code