diff --git a/.github/actions/build-cache/action.yml b/.github/actions/build-cache/action.yml index 3f78be6ad0..08e68b5e68 100644 --- a/.github/actions/build-cache/action.yml +++ b/.github/actions/build-cache/action.yml @@ -4,16 +4,28 @@ runs: using: "composite" # Make sure to keep these cache entries in sync with those in writecache.yml steps: + - id: find-go-build-cache + shell: bash + run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT - name: Restore Go Modules Cache id: cache-go-modules uses: actions/cache/restore@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go + path: | + ~/go/pkg/mod + ${{ steps.find-go-build-cache.outputs.cache }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + ${{ runner.os }}- - name: Restore Maven Modules Cache id: cache-maven uses: actions/cache/restore@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-maven + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + ${{ runner.os }}-maven- + diff --git a/.github/workflows/writecache.yml b/.github/workflows/writecache.yml index 92c5d4743e..242de489d2 100644 --- a/.github/workflows/writecache.yml +++ b/.github/workflows/writecache.yml @@ -27,15 +27,18 @@ jobs: run: mvn dependency:resolve --batch-mode - name: Download Go Dependencies run: go mod download -x - - name: Save Go Modules Cache - id: cache-go-modules - uses: actions/cache/save@v4 + - id: find-go-build-cache + shell: bash + run: echo "cache=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + - uses: actions/cache/save@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go + path: | + ~/go/pkg/mod + ${{ steps.find-go-build-cache.outputs.cache }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - name: Save Maven Modules Cache id: cache-maven uses: actions/cache/save@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-maven + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}