Skip to content

Commit

Permalink
chore: update github action to new setup-java v2 (#9068)
Browse files Browse the repository at this point in the history
The v2 of actions/setup-java supports caching out of the box
https://github.com/actions/setup-java\#caching-maven-dependencies
Updating to v2 will give us future improvements to caching configuration
automatically.

since v1 used the zulu distribution https://github.com/actions/setup-java/blob/main/README.md\#v2-vs-v1
I stuck with it. Providing the distribution is now mandatory.

Once actions/runner-images#3859 is done
and the VMs have temurin pre-installed we should switch to save
additional time.
  • Loading branch information
teleivo authored Oct 20, 2021
1 parent bbaa9c4 commit d3a563d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 42 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/analyse-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11

- name: Cache maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
distribution: zulu
cache: maven

- name: Analyse PR
env:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11

- name: Cache maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
distribution: zulu
cache: maven

- name: Check formatting in core
env:
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ jobs:
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

- name: Cache maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Setup-java
uses: actions/setup-java@v1
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: zulu
cache: maven

- name: Codeql-init
uses: github/codeql-action/init@v1
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11

- name: Cache maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
distribution: zulu
cache: maven

- name: Test core
env:
Expand All @@ -36,16 +31,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11

- name: Cache maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
distribution: zulu
cache: maven

- name: Run integration tests
env:
Expand Down

0 comments on commit d3a563d

Please sign in to comment.