Skip to content

Commit

Permalink
Switch setup-java cache (#2481)
Browse files Browse the repository at this point in the history
* Switch from actions/cache to the new built-in cache in actions/setup-java
* Fix some workflows using mvnw without explicitly installing Java

Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
  • Loading branch information
steven-sheehy authored Aug 31, 2021
1 parent 3b355cc commit e975816
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 60 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Cache Maven Packages
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Create and Switch to Release Branch
run: |
Expand Down Expand Up @@ -172,12 +172,12 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Cache Maven Packages
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Reset main to release branch
run: |
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/grpc-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v2
with:
cache: 'maven'
distribution: 'adopt'
java-version: 11

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

- name: Maven verify
run: ./mvnw ${MAVEN_CLI_OPTS} verify -pl "${MODULE}" --also-make -Dspring.profiles.active=${{ matrix.schema }}
working-directory: .
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/importer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v2
with:
cache: 'maven'
distribution: 'adopt'
java-version: 11

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

- name: Maven verify
run: ./mvnw ${MAVEN_CLI_OPTS} verify -pl "${MODULE}" --also-make -Dspring.profiles.active=${{ matrix.schema }}
working-directory: .
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,10 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v2
with:
cache: 'maven'
distribution: 'adopt'
java-version: 11

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

- name: Maven verify
run: ./mvnw ${MAVEN_CLI_OPTS} verify -pl "${MODULE}" --also-make -Dtest='!com.hedera.mirror.importer.**' -DfailIfNoTests=false
working-directory: .
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Maven packages
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Login to Google Container Registry
uses: google-github-actions/setup-gcloud@master
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Maven packages
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Login to Google Container Registry
uses: google-github-actions/setup-gcloud@master
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Maven dependencies
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Vulnerability check
run: ./mvnw ${MAVEN_CLI_OPTS} dependency-check:aggregate
Expand All @@ -38,12 +38,12 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache Maven dependencies
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Cache SonarCloud dependencies
uses: actions/cache@v2
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Cache Maven packages
uses: actions/cache@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
path: ~/.m2
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
distribution: 'adopt'
java-version: 11

- name: Maven package
run: ./mvnw.cmd package --batch-mode --no-transfer-progress -DskipTests

0 comments on commit e975816

Please sign in to comment.