diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 80265bdb..cf36c9b5 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -49,6 +49,20 @@ jobs: cache: true check-latest: true + - name: "Retrieve GOPATH" + id: retrieve + run: echo "GOPATH=$(go env GOPATH)" >> "$GITHUB_OUTPUT" + + - name: "Setup GOPATH/bin cache" + uses: actions/cache@v4 + with: + path: "${{ steps.retrieve.outputs.GOPATH }}/bin/" + key: "${{ runner.os }}-${{ runner.arch }}-gobin-go${{ env.GO_VERSION }}-${{ hashFiles('**/Makefile') }}" + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-gobin-go${{ env.GO_VERSION }}-${{ hashFiles('**/Makefile') }} + ${{ runner.os }}-${{ runner.arch }}-gobin-go${{ env.GO_VERSION }}- + ${{ runner.os }}-${{ runner.arch }}-gobin- + - name: "Download and verify dependencies" id: deps run: make GOCACHE="$(go env GOCACHE)" deps diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99653789..bcdd2660 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,7 +97,7 @@ jobs: check-latest: true - name: "Download and verify dependencies" - run: make GOCACHE="$(go env GOCACHE)" deps + run: make GOCACHE="$(go env GOCACHE)" go-deps - name: "Create binary archive for ${{ matrix.goos }}/${{ matrix.goarch }}" env: diff --git a/Makefile b/Makefile index 626c4458..e181e199 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ cmds = \ popmd \ tbcd -.PHONY: all clean clean-dist deps $(cmds) build install lint lint-deps tidy race test vulncheck \ +.PHONY: all clean clean-dist deps go-deps $(cmds) build install lint lint-deps tidy race test vulncheck \ vulncheck-deps dist archive sources checksums all: lint tidy test build install @@ -42,7 +42,9 @@ clean-dist: clean-test: rm -rf $(PROJECTPATH)/service/tbc/.testleveldb/ -deps: lint-deps vulncheck-deps +deps: lint-deps vulncheck-deps go-deps + +go-deps: go mod download go mod verify