Skip to content

Commit

Permalink
ci: cache GOPATH/bin, install only gomod deps in release
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuasing committed Jul 1, 2024
1 parent b5122d8 commit 4daf61e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 4daf61e

Please sign in to comment.