Skip to content

Commit

Permalink
chore: Don't store cache of Maven packages for PR builds (#399)
Browse files Browse the repository at this point in the history
* chore: Don't store GitHub cache for Maven packages in PR builds

* chore: Don't store GitHub cache for Maven packages in PR builds
  • Loading branch information
mthmulders authored Aug 8, 2024
1 parent ef5f966 commit 712795e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ jobs:
distribution: 'adopt'
cache: maven
- name: Cache Maven packages
uses: actions/cache@v4.0.2
id: restore-maven-package-cache
uses: actions/cache/restore@v4.0.2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B verify
- name: Save downloaded Maven packages
uses: actions/cache/save@v4.0.2
with:
path: ~/.m2
key: ${{ steps.restore-maven-package-cache.outputs.cache-primary-key }}
if: github.event_name != 'pull_request'
10 changes: 9 additions & 1 deletion .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ jobs:
if: matrix.os == 'ubuntu-latest'

- name: Cache Maven packages
uses: actions/cache@v4.0.2
id: restore-maven-package-cache
uses: actions/cache/restore@v4.0.2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down Expand Up @@ -103,6 +104,13 @@ jobs:
target/distributions/*.zip
target/distributions/*.tar.gz
- name: Save downloaded Maven packages
uses: actions/cache/save@v4.0.2
with:
path: ~/.m2
key: ${{ steps.restore-maven-package-cache.outputs.cache-primary-key }}
if: github.event_name != 'pull_request'

# Collect all executables and release
release:
needs: [ build ]
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/mutation-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ jobs:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

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

- name: Set up JDK
uses: actions/setup-java@v4.2.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
distribution: 'adopt'

- name: Cache Maven packages
uses: actions/cache@v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down

0 comments on commit 712795e

Please sign in to comment.