From b1e0a00ab7cdba46d79beacee146ec1b5fffeeee Mon Sep 17 00:00:00 2001 From: xhe Date: Sun, 9 Oct 2022 15:46:29 +0800 Subject: [PATCH] *: fix CI cache (#107) --- .github/workflows/common.yml | 12 ++++++------ Makefile | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 018c217f..5bfe9a8c 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -46,20 +46,20 @@ jobs: go-version-file: go.mod check-latest: true - name: "set vars" + id: cache run: | - echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV - echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV + echo "::set-output name=go_cache::$(go env GOCACHE)" + echo "::set-output name=go_mod_cache::$(go env GOMODCACHE)" - name: "try to use build cache" uses: actions/cache@v3 with: path: | - ${{ env.GOCACHE }} - ${{ env.GOMODCACHE }} - key: ${{ runner.os }}-go-${{ inputs.target == "cache" && github.run_id || hashFiles('**/go.sum')}} + ${{ steps.cache.outputs.go_cache }} + ${{ steps.cache.outputs.go_mod_cache }} + key: ${{ runner.os }}-go-${{ inputs.target == 'cache' && github.run_id || hashFiles('**/go.sum')}} restore-keys: | ${{ runner.os }}-go- - name: make ${{ inputs.target }} - if: ${{ inputs.target != '' }} run: make ${{ inputs.target }} - name: "set up tmate session if necessary" if: ${{ failure() && inputs.debug }} diff --git a/Makefile b/Makefile index ca067d13..51e44e16 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,8 @@ default: cmd dev: cmd lint test +cache: build lint test + cmd: $(EXECUTABLE_TARGETS) cmd_%: OUTPUT=$(patsubst cmd_%,./bin/%,$@)