Skip to content

Cache gradle in GitHub workflows#4304

Closed
trivikr wants to merge 2 commits intosmithy-lang:mainfrom
trivikr:gradle-cache
Closed

Cache gradle in GitHub workflows#4304
trivikr wants to merge 2 commits intosmithy-lang:mainfrom
trivikr:gradle-cache

Conversation

@trivikr
Copy link

@trivikr trivikr commented Sep 16, 2025

Motivation and Context

smithy-lang/smithy#2776

Description

Cache gradle in GitHub workflows

Testing

CI

Checklist

  • For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "client," "server," or both in the applies_to key.
  • For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "aws-sdk-rust" in the applies_to key.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr requested review from a team as code owners September 16, 2025 17:25
@landonxjames
Copy link
Contributor

Does this just cache the gradle binary or does it also cache all of the related build dependencies? We are already caching the gradle binary in our build image (or should be, it has broken a few times recently) since it would fail to download regularly and cause CI/Catapult issues.

@trivikr
Copy link
Author

trivikr commented Sep 16, 2025

It caches the following as per documentation

**/*.gradle*, **/gradle-wrapper.properties, buildSrc/**/Versions.kt, buildSrc/**/Dependencies.kt, gradle/*.versions.toml, and **/versions.properties

It caches gradle dependencies in Github Action workflows.
It's different from other workflows you may be running on AWS infrastructure.

@trivikr
Copy link
Author

trivikr commented Sep 16, 2025

I noticed that gradle dependencies are already being cached in one workflow

I've removed the explicit code in ebb57ef (#4304), if you want to compare if built-in caching solution is helpful

@trivikr
Copy link
Author

trivikr commented Sep 16, 2025

I noticed that CI from fork is different action as compared to CI.

Feel free to cherry-pick commits from this PR and post a new one from upstream branch if you want to experiment with cache config of actions/setup-java. This PR can be closed.

@trivikr
Copy link
Author

trivikr commented Sep 16, 2025

Closing as gradle/actions/setup-gradle seems to be the recommended solution for caching

Details in https://www.github.com/actions/setup-java/issues/588

@trivikr trivikr closed this Sep 16, 2025
@trivikr trivikr deleted the gradle-cache branch September 16, 2025 19:17
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