From 8b6b39bbd9018786bcfe1578b2a69547e08653db Mon Sep 17 00:00:00 2001 From: Maarten Mulders Date: Thu, 8 Aug 2024 21:45:11 +0200 Subject: [PATCH 1/2] chore: Don't store GitHub cache for Maven packages in PR builds --- .github/workflows/build.yml | 7 +++++++ .github/workflows/early-access.yml | 8 ++++++++ .github/workflows/mutation-testing.yml | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18cfeca..3748b39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: distribution: 'adopt' cache: maven - name: Cache Maven packages + id: restore-maven-package-cache uses: actions/cache@v4.0.2 with: path: ~/.m2 @@ -31,3 +32,9 @@ jobs: 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' \ No newline at end of file diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index 8fcd754..aa1fec2 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -74,6 +74,7 @@ jobs: if: matrix.os == 'ubuntu-latest' - name: Cache Maven packages + id: restore-maven-package-cache uses: actions/cache@v4.0.2 with: path: ~/.m2 @@ -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 ] diff --git a/.github/workflows/mutation-testing.yml b/.github/workflows/mutation-testing.yml index cb40e0a..19fff44 100644 --- a/.github/workflows/mutation-testing.yml +++ b/.github/workflows/mutation-testing.yml @@ -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.1 with: From a922d6451f312fdcaec6b4ab58728ff7128af5ba Mon Sep 17 00:00:00 2001 From: Maarten Mulders Date: Thu, 8 Aug 2024 21:52:43 +0200 Subject: [PATCH 2/2] chore: Don't store GitHub cache for Maven packages in PR builds --- .github/workflows/build.yml | 2 +- .github/workflows/early-access.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3748b39..e3fb20e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: cache: maven - name: Cache Maven packages id: restore-maven-package-cache - uses: actions/cache@v4.0.2 + uses: actions/cache/restore@v4.0.2 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index aa1fec2..1be14ee 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -75,7 +75,7 @@ jobs: - name: Cache Maven packages id: restore-maven-package-cache - uses: actions/cache@v4.0.2 + uses: actions/cache/restore@v4.0.2 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e11454..9a74a2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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') }}