From 8fc8e6c72114bd181e6071af4a85fb3a09bd8d35 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 10 Oct 2024 08:28:42 +1100 Subject: [PATCH] chore: caching fixes - Don't create docker cache on PR - Change the way maven write caching works --- .github/actions/build-cache/action.yml | 2 +- .github/workflows/writecache.yml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-cache/action.yml b/.github/actions/build-cache/action.yml index 1b98a87c1..15a3c97fe 100644 --- a/.github/actions/build-cache/action.yml +++ b/.github/actions/build-cache/action.yml @@ -11,6 +11,7 @@ runs: uses: ScribeMD/docker-cache@0.5.0 with: key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }} + read-only: true - name: Restore Go Modules Cache id: cache-go-modules uses: actions/cache/restore@v4 @@ -28,7 +29,6 @@ runs: with: path: | ~/.m2/repository - **SNAPSHOT** key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/writecache.yml b/.github/workflows/writecache.yml index b21eba21a..92f0bf883 100644 --- a/.github/workflows/writecache.yml +++ b/.github/workflows/writecache.yml @@ -35,6 +35,10 @@ jobs: ~/go/pkg/mod ${{ steps.find-go-build-cache.outputs.cache }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + - name: Delete Maven Snapshots + id: maven-delete-snapshots + run: | + find ~/.m2/repository -type d -name "*SNAPSHOT" -exec rm -rf {} + - name: Save Maven Modules Cache id: cache-maven uses: actions/cache/save@v4 @@ -49,3 +53,7 @@ jobs: ~/.pnpm-store node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + - name: Save Docker Images + uses: ScribeMD/docker-cache@0.5.0 + with: + key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }} \ No newline at end of file