Skip to content

Cache the downloads of the Gradle plugins' TestKit builds - #291

Merged
abashev merged 1 commit into
21.X.Xfrom
abashev/Cache-fix
Nov 28, 2026
Merged

abashev merged 1 commit into
21.X.Xfrom
abashev/Cache-fix

Conversation

@abashev

@abashev abashev commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Before this PR

The Gradle plugins' tests build their projects with TestKit, and those builds have a Gradle user home of their own, under gradle-open-java-format/build/tmp/test/work/.gradle-test-kit by default. setup-gradle caches ~/.gradle only, so every job that runs the tests (build, three build (JDK …) legs, four native (…) jobs) downloaded the Android Gradle plugin and its dependencies, about 127 MB, from Maven Central again. On 2026-11-28 the merges of #289 and #290 three minutes apart started sixteen such jobs, and Maven Central answered 429 Too Many Requests: native (ubuntu-24.04) failed 16 AndroidTest and 2 MultiProjectTest cases.

After this PR

  • -PtestkitDir sets the TestKit builds' Gradle user home, through org.gradle.testkit.dir. CI passes $GRADLE_USER_HOME/test-kit in the three jobs that run the plugins' tests, and every setup-gradle step adds test-kit/caches/modules-2 to the paths it caches, next to the default caches and notifications. Only the downloads go in; the transforms and generated jars of those builds, about 340 MB, are made on the runner as before.
  • Locally the default stays: one directory for every checkout would be shared by tests that delete from it.
  • MultiProjectTest's library with variants is looked for in its own repository only, through exclusiveContent. The root project asked Maven Central for test:variants:1.0 first, which failed that test on a 429 too.

Checked locally: AndroidTest (16) and MultiProjectTest (10) pass with -PtestkitDir pointing at an empty directory, the downloads land there, and the default directory is not created. The cache itself is written by builds of 21.X.X only, so it fills on the first push after the merge and is read from the run after that.

Possible downsides?

setup-gradle most likely does not deduplicate a nested modules-2: its extraction patterns start at the root of the Gradle user home. The 127 MB would then go into each job's own entry, about 10 MB today, so roughly 1.1 GB of the repository's 10 GB for the eight jobs; the job summary shows the sizes after the first run on 21.X.X. If that is too much, a separate actions/cache entry per OS for the directory would hold one copy.

The TestKit builds of the Gradle plugins' tests have a Gradle user home
of their own, under build/tmp/test/work by default, which CI's cache
does not reach. Every job that runs those tests downloaded the Android
Gradle plugin and its dependencies, about 127 MB, from Maven Central
again: eight jobs a push, and on 2026-11-28 two pushes three minutes
apart got 429 Too Many Requests from Maven Central.

-PtestkitDir now sets that home. CI points it at test-kit in the Gradle
user home and adds test-kit/caches/modules-2 to the paths setup-gradle
caches. Locally the default stays: one directory for every checkout
would be shared by tests that delete from it.

MultiProjectTest's library with variants is looked for in its own
repository only. The root project asked Maven Central for it first,
which failed that test on a 429 as well.
@abashev
abashev merged commit 8c9018a into 21.X.X Nov 28, 2026
17 checks passed
@abashev
abashev deleted the abashev/Cache-fix branch November 28, 2026 20:00
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