8000 Improved gradle cache key calculation example by odin-delrio · Pull Request #507 · actions/cache · GitHub
[go: up one dir, main page]

Skip to content

Improved gradle cache key calculation example #507

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

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

odin-delrio
Copy link
Contributor
@odin-delrio odin-delrio commented Jan 13, 2021

Context

Without taking into account the gradle-wrapper.properties for the cache key, whenever the gradle version gets updated in that file, GH cache will still use the cache generated for the previous version.

That will make subsequent builds to regenerate the gradle-api-XX.jar artifact every single time, and that operation is very expensive, 25 seconds in the build I detected this on a GH Actions runner.

Example log indicating that expensive operation being executed:

Generating /home/runner/.gradle/caches/6.8/generated-gradle-jars/gradle-api-6.8.jar

Proposed change

Provide an example that actually takes the gradle-wrapper.properties into account for the cache key generation, so if the gradle version gets updated the cache will be regenerated, making subsequent builds much faster.

Also, it would be nice that the example provided in the webiste docs is aligned with these ones, currently the one in the web doesn't match with the one here for gradle.

@odin-delrio odin-delrio requested a review from a team as a code owner January 13, 2021 21:23
Copy link
Contributor
@konradpabjan konradpabjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! @odin-delrio

We have a public repo for our docs where you can update the Gradle example as well. See this file: https://github.com/github/docs/blob/main/content/actions/guides/building-and-testing-java-with-gradle.md

@konradpabjan konradpabjan merged commit 3303695 into actions:main Jan 14, 2021
This was referenced Mar 6, 2021
This was referenced Mar 16, 2021
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.

2 participants
0