Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to use gradle wrapper for cache cleanup #525

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

bigdaz
Copy link
Member

@bigdaz bigdaz commented Jan 22, 2025

The cache-cleanup operation works by executing Gradle on a dummy project and a custom init-script. The version of Gradle used should be at least as high as the newest version used to run a build.

Previously, if the Gradle version on PATH didn't meet this requirement, the action would download and install the required Gradle version.

With this PR, the action will now use an existing Gradle wrapper distribution if it meets the requirement. This avoids unnecessary downloads of Gradle versions that are already present on the runner.

The logic is:

  • Determine the newest version of Gradle that was executed during the Job. This is the 'minimum version' for cache cleanup.
  • Inspect the Gradle version on PATH and any detected wrapper scripts to see if they meet the 'minimum version'.
  • The first executable that is found to meet the requirements will be used for cache-cleanup.
  • If no executable is found that meets the requirements, attempt to provision Gradle with the 'minimum version'.

Fixes #515

@bigdaz bigdaz changed the title Use wrapper for cleanup Use gradle wrapper for cache cleanup if available Jan 23, 2025
@bigdaz bigdaz marked this pull request as ready for review January 23, 2025 02:00
@bigdaz bigdaz force-pushed the dd/use-wrapper-for-cleanup branch from 19ea251 to bdf04d0 Compare January 23, 2025 02:01
@bigdaz bigdaz changed the title Use gradle wrapper for cache cleanup if available Attempt to use gradle wrapper for cache cleanup Jan 23, 2025
@bigdaz bigdaz marked this pull request as draft January 24, 2025 00:34
@bigdaz bigdaz force-pushed the dd/use-wrapper-for-cleanup branch 2 times, most recently from 51cf5da to 83dd2a3 Compare January 24, 2025 15:22
@bigdaz bigdaz marked this pull request as ready for review January 24, 2025 15:52
@bigdaz bigdaz force-pushed the dd/use-wrapper-for-cleanup branch from 83dd2a3 to 973a4e4 Compare January 24, 2025 15:53
@bigdaz bigdaz requested a review from a team January 24, 2025 15:54
Copy link
Contributor

Job Summary for Gradle

Demo adding Build Scan® comment to PR :: successful-build-with-always-comment
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
kotlin-dsl build 8.12 Build Scan published

@bigdaz bigdaz merged commit 91619fa into main Jan 24, 2025
125 checks passed
@bigdaz bigdaz deleted the dd/use-wrapper-for-cleanup branch January 24, 2025 17:06
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.

Action should use existing Gradle wrapper distributions for cache-cleanup where possible
2 participants