Restore dependency and wrapper caches concurrently - #1174
Merged
Conversation
Run primary dependency and wrapper cache restores in parallel while preserving existing outputs and save semantics. Add unit and E2E coverage for concurrent restore behavior, wrapper cache validation, and additional-cache error handling. Include a manual benchmark workflow for baseline-vs-candidate restore timing comparisons across OSes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d43ec3dd-96c7-4eb3-909e-b8123cd12d3c
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces setup-java cache-enabled Maven/Gradle setup time by restoring the primary dependency cache and independent wrapper caches concurrently, while preserving primary-cache outputs/semantics and improving resilience when additional-cache saves fail.
Changes:
- Restore primary dependency cache and additional wrapper caches in parallel after concurrently computing cache keys and persisting restore state.
- Add wrapper-cache restore-miss logging and make additional-cache save failures non-blocking for the primary cache save.
- Extend unit/E2E coverage and add a manual benchmark workflow + helper script to compare sequential vs concurrent restore wall times.
Show a summary per file
| File | Description |
|---|---|
| src/cache.ts | Implements concurrent key computation + concurrent restore for primary/additional caches; adjusts save error handling and logs. |
| dist/setup/index.js | Bundled build output reflecting the new restore/save behavior (setup entrypoint). |
| dist/cleanup/index.js | Bundled build output reflecting the new restore/save behavior (post/cleanup entrypoint). |
| .github/workflows/e2e-cache.yml | Extends cache E2E workflow to assert wrapper cache artifacts are restored for Maven/Gradle flows. |
| .github/workflows/benchmark-cache-restore.yml | Adds a manual benchmark workflow to compare baseline vs candidate cache restore wall time across OSes/tools/profiles. |
| tests/cache/maven/.mvn/wrapper/maven-wrapper.properties | Adds Maven wrapper properties fixture for wrapper-cache keying in tests/E2E. |
| tests/cache/gradle1/gradle/wrapper/gradle-wrapper.properties | Adds Gradle wrapper properties fixture for wrapper-cache keying in tests/E2E. |
| tests/cache.test.ts | Adds concurrency-focused unit tests and coverage for continuing primary save after additional-cache failure. |
| tests/benchmark-cache-restore.sh | Adds helper script used by the benchmark workflow to prepare/reset/populate/record/summarize timings. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
.github/workflows/e2e-cache.yml:317
- Step name says the Maven Wrapper cache "has been made" in the restore job, but this job is validating that the wrapper cache was restored from the previous save. The wording is misleading and inconsistent with the earlier maven-restore job step name.
- name: Confirm that the Maven Wrapper cache has been made
- Files reviewed: 7/9 changed files
- Comments generated: 1
- Review effort level: Low
Use env variables for cache-hit values in benchmark record steps to avoid expression expansion in run commands, and rename E2E restore step labels for clarity. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d43ec3dd-96c7-4eb3-909e-b8123cd12d3c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Description:
This reduces setup time for cache-enabled Maven and Gradle jobs by running independent restore operations in parallel instead of serially. The change preserves current behavior for outputs, optional wrapper cache skipping, and post-job save sequencing, while tightening failure handling so wrapper save failures do not block the main dependency cache save.
Implementation highlights:
cache-primary-keyandcache-hitsemantics tied to the primary dependency cache.Fixes: #1171
Related issue:
#1171
Check list:
npm run checklocally (format, lint, build, test) and all checks pass.