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

Use setup-java action to cache dependencies #3593

Closed
wants to merge 1 commit into from
Closed

Use setup-java action to cache dependencies #3593

wants to merge 1 commit into from

Conversation

jongwooo
Copy link

@jongwooo jongwooo commented Jan 1, 2023

Signed-off-by: jongwooo jongwooo.han@gmail.com

Description

Updated workflows 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 ${{ matrix.java }}
  uses: actions/setup-java@v2
  with:
    java-version: ${{ matrix.java }}
    distribution: 'temurin'

TO-BE

- name: Set up JDK ${{ matrix.java }}
  uses: actions/setup-java@v3
  with:
    java-version: ${{ matrix.java }}
    distribution: 'temurin'
    cache: 'maven'

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

References

actions/setup-java#caching-packages-dependencies

Signed-off-by: jongwooo <jongwooo.han@gmail.com>
@CLAassistant
Copy link

CLAassistant commented Jan 1, 2023

CLA assistant check
All committers have signed the CLA.

@DoodleBobBuffPants
Copy link
Contributor

Thanks for the PR - this was merged into our internal pipeline and the change will be reflected in this repo in the next release

@jongwooo jongwooo deleted the chore/use-setup-java-action-to-cache-dependencies branch January 3, 2023 13:38
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.

None yet

3 participants