Skip to content

chore: Use cache in continuous-integration-workflow.yml #12449

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

Closed
wants to merge 1 commit into from
Closed

chore: Use cache in continuous-integration-workflow.yml #12449

wants to merge 1 commit into from

Conversation

jongwooo
Copy link
Contributor

@jongwooo jongwooo commented Dec 23, 2022

Signed-off-by: jongwooo [email protected]

Description

Updated continuous-integration-workflow.yml to cache dependencies using actions/setup-java. setup-java@v3 or newer has caching built-in.

About caching workflow dependencies

Jobs on GitHub-hosted runners start in a clean virtual environment and must download dependencies each time, causing increased network utilization, longer runtime, and increased cost. To help speed up the time it takes to recreate files like dependencies, GitHub can cache files that frequently use in workflows.

Solutions

Java projects can run faster on GitHub Actions by enabling dependency caching on the setup-java action. setup-java supports caching for both Gradle and Maven projects.

AS-IS

- name: Set up JDK 17
  uses: actions/setup-java@v3
  with:
    java-version: '17'
    distribution: 'temurin'

TO-BE

- name: Set up JDK 17
  uses: actions/setup-java@v3
  with:
    java-version: '17'
    distribution: 'temurin'
    cache: 'gradle'

It’s literally a one line change to pass the cache: 'gradle' input parameter.

References

actions/setup-java#caching-packages-dependencies
How to build Gradle projects with GitHub Actions

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 23, 2022
@jzheaux
Copy link
Contributor

jzheaux commented Jan 5, 2023

Thanks, @jongwooo. Will you please rebase this to 5.7.x so that we can apply this to all branches?

@jzheaux jzheaux self-assigned this Jan 5, 2023
@jzheaux jzheaux added in: build An issue in the build type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 5, 2023
@jongwooo
Copy link
Contributor Author

jongwooo commented Jan 6, 2023

@jzheaux I tried to rebase with git rebase 5.7.x, but it resulted in a conflict. It would be grateful if you could tell me how to rebase it.

@jzheaux
Copy link
Contributor

jzheaux commented Jan 6, 2023

Try this, please:

git checkout 5.7.x
git cherry-pick 7a9eb93b34e0233dd3a3dbc39f2f858639a6c5a9
git push ${remote} +chore/use-setup-java-action-to-cache-dependencies

where ${remote} is the remote for your fork. It may be origin, for example.

Then, change the base of this PR to spring-projects:5.7.x.

@jongwooo jongwooo closed this Jan 7, 2023
@jongwooo jongwooo deleted the chore/use-setup-java-action-to-cache-dependencies branch January 7, 2023 08:55
@jongwooo
Copy link
Contributor Author

jongwooo commented Jan 7, 2023

@jzheaux I made a mistake and the PR was closed. So I reopened at #12503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: build An issue in the build type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants