Repository navigation
Conversation
Robolectric downloads the android-all-instrumented jars at test runtime into ~/.m2, which setup-gradle does not cache, so each CI run downloads 100-200 MB per SDK level. Cache that directory, keyed on the Robolectric version and the SDK levels the tests use. Locally, an empty jar cache makes the core and replay test run take 158-207s instead of 76-88s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
📲 Install BuildsAndroid
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each PR used to save its own ~700 MB entry, which only that PR can use. Now PRs only restore the entry that main saves, like setup-gradle does for the Gradle caches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
closing in favour #6553 |
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.
PR Stack (Robolectric CI)
📜 Description
Caches
~/.m2/repository/org/robolectricin the Build job:actions/cache/restore) beforemake preMerge.mainsaves it (actions/cache/save), and only when there was no exact hit. PRs read the entry thatmainsaved, likesetup-gradledoes for the Gradle caches. Otherwise each PR would save its own ~700 MB entry that only that PR can use.The cache key is a hash of the Robolectric version line in
libs.versions.tomland everysdk = [...]/sdk=in the test sources. So the key changes only when the Robolectric version or the set of SDK levels changes, not on each dependency bump.restore-keysallows a partial hit, so a new SDK level downloads only its own jar.💡 Motivation and Context
Robolectric downloads the android-all-instrumented jars at test runtime into
~/.m2/repository.setup-gradlecaches only~/.gradle, so each CI run that executes Robolectric tests downloads 100-200 MB per SDK level. With the levels from #6544, that is ~713 MB for core and replay.💚 How did you test it?
A temporary benchmark workflow (not part of this PR) ran only the core and replay Robolectric tests. Each job ran cold runs (jars deleted first) and warm runs in turns on the same runner, so the runner hardware does not affect the comparison. Mean of 3 rounds per job:
So the cache saves about 4-5s per run with #6544, and up to ~11s without it. Runners download from Maven Central at about 150-370 MB/s, so the download is short.
curlof the same 6 jars takes about 3.5s.Note: a first comparison of two Build runs of this PR (cache miss vs. hit) showed 2.5 min less, but most of that was runner variance. All test tasks in that run were 20-30% faster, including the Spring tests, which do not use Robolectric.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The entry is ~750 MB of the repo's 50 GB Actions cache. If cache pressure becomes a problem, remove
restore-keysso that old jars do not stay in the entry after a Robolectric upgrade.🤖 Generated with Claude Code
#skip-changelog