JetBrains / intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Apache License 2.0
3.05k stars 618 forks source link

Use setup-java action to cache dependencies #331

Closed jongwooo closed 1 year ago

jongwooo commented 1 year ago

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: Setup Java
  uses: actions/setup-java@v3
  with:
    distribution: zulu
    java-version: 11

TO-BE

- name: Setup Java
  uses: actions/setup-java@v3
  with:
    distribution: zulu
    java-version: 11
    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

codecov-commenter commented 1 year ago

Codecov Report

Base: 45.00% // Head: 45.00% // No change to project coverage :thumbsup:

Coverage data is based on head (b1aebb1) compared to base (61a1a04). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #331 +/- ## ======================================= Coverage 45.00% 45.00% ======================================= Files 4 4 Lines 20 20 Branches 3 3 ======================================= Hits 9 9 Misses 9 9 Partials 2 2 ``` Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JetBrains). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JetBrains)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

hsz commented 1 year ago

Sorry for the late response — I wasn't entirely sure if GitHub Actions already works well with caching — I had troubles with that a couple of months ago.

Merged, thanks!