From b066785b00775199bea8928bff7547765dc55fea Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 10:32:03 +0200 Subject: [PATCH] CI: Update cache paths. --- .github/workflows/lint.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 18 +++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8e59ea9..df4457e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,6 +19,23 @@ jobs: continue-on-error: true steps: - uses: actions/checkout@v3 + - id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + echo "::set-output name=go-version::$(go version | cut -d ' ' -f 3)" + + - name: Go build cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-build-${{ hashFiles('**/go.mod', '**/go.sum') }} + + - name: Go mod cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }} - name: Install dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d415afe..ba2800c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,11 +30,23 @@ jobs: with: go-version: ${{ matrix.go-version }} - - name: Cache dependencies + - id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + echo "::set-output name=go-version::$(go version | cut -d ' ' -f 3)" + + - name: Go build cache uses: actions/cache@v3 with: - path: vendor/ - key: vendor-${{ matrix.go-version }}-${{ hashFiles('go.mod', 'go.sum') }} + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-build-${{ hashFiles('**/go.mod', '**/go.sum') }} + + - name: Go mod cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }} - name: Build applications run: |