Skip to content

Test setup-java PR #1097: wrapper cache separation#5

Open
brunoborges wants to merge 1 commit into
mainfrom
brunoborges-test-setup-java-pr-1097
Open

Test setup-java PR #1097: wrapper cache separation#5
brunoborges wants to merge 1 commit into
mainfrom
brunoborges-test-setup-java-pr-1097

Conversation

@brunoborges

Copy link
Copy Markdown
Owner

Adds a workflow to test actions/setup-java#1097"Cache Maven and Gradle wrapper distributions separately from the dependency cache" (fixes actions/setup-java#1095).

Pinned to the PR head commit 6cd4d8602abcb93d479ac1a322ebf80166d853e6.

What it verifies

The PR moves each build tool's wrapper distribution into its own cache entry keyed only on the wrapper properties file, so it survives the frequent dependency changes that rotate (and miss) the main dependency cache.

.github/workflows/wrapper-cache.yml proves this deterministically in a single run:

  • maven-prime / gradle-prime — run ./mvnw / ./gradlew, downloading the wrapper distribution; setup-java's post step saves both the main dependency cache and the separate maven-wrapper / gradle-wrapper caches.
  • maven-verify / gradle-verify — on a fresh runner, first rotate the main dependency cache key by editing pom.xml / build.gradle (without touching the wrapper properties), then run setup-java. The main dependency cache MISSES (cache-hit == false) but the wrapper distribution is still restored from its independent cache. The job asserts the wrapper dist is on disk before building — exactly the #1095 scenario the PR fixes.
  • verify-cache-entries — lists the repo's Actions caches and asserts distinct *-maven-wrapper-* and *-gradle-wrapper-* entries exist alongside the main maven / gradle dependency caches (separation, not replacement).

New fixtures

  • maven-wrapper-project/ — a Maven project with a real only-script wrapper (.mvn/wrapper/maven-wrapper.properties → Maven 3.9.14), needed because no existing project had a Maven wrapper. The Gradle side reuses the existing javac-matcher-gradle wrapper.

Adds a Maven wrapper project (.mvn/wrapper/maven-wrapper.properties + mvnw)
and a workflow pinned to actions/setup-java#1097 (SHA 6cd4d86) that proves
wrapper distributions are cached separately from the dependency cache.

Each build tool has a prime job (populates caches) and a verify job that
rotates the main dependency cache key (edits pom.xml / build.gradle) so the
dependency cache MISSES while the wrapper cache still HITS, asserting the
wrapper distribution is restored despite the miss (fixes #1095). A final job
lists the repo caches and asserts distinct *-maven-wrapper-* / *-gradle-wrapper-*
entries exist.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Maven wrapper caching does not seem to cache enough

1 participant