Skip to content

Commit d2909e8

Browse files
committed
Cache toolchain
1 parent 0c2c580 commit d2909e8

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

.github/actions/setup-go/action.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
name: "Setup Go"
22
description: |
33
Sets up the Go environment for tests, builds, etc.
4+
inputs:
5+
version:
6+
description: "The Go version to use."
7+
default: "1.20.5"
48
runs:
59
using: "composite"
610
steps:
11+
- name: Cache go toolchain
12+
uses: buildjet/cache@v3
13+
with:
14+
path: |
15+
${{ env.RUNNER_TOOL_CACHE }}/go/${{ inputs.version }}
16+
key: gotoolchain-${{ runner.os }}-${{ inputs.version }}
17+
restore-keys: |
18+
gotoolchain-${{ runner.os }}-
19+
720
- uses: buildjet/setup-go@v4
821
with:
922
# We do our own caching for implementation clarity.
1023
cache: false
11-
go-version: "1.20.5"
24+
go-version: ${{ inputs.version }}
1225

1326
- name: Cache go
1427
uses: buildjet/cache@v3
@@ -21,11 +34,11 @@ runs:
2134
~/Library/Caches/go-build
2235
# Job name must be included in the key for effective
2336
# test cache reuse.
24-
key: go-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
37+
key: gocache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
2538
restore-keys: |
26-
go-${{ runner.os }}-${{ github.job }}-
27-
go-${{ runner.os }}-
28-
go-
39+
gocache-${{ runner.os }}-${{ github.job }}-
40+
gocache-${{ runner.os }}-
41+
gocache-
2942
3043
- name: Install gotestsum
3144
uses: jaxxstorm/action-install-gh-release@v1.10.0

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ jobs:
161161
162162
- name: go install tools
163163
run: |
164-
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30 \
165-
storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33 \
166-
golang.org/x/tools/cmd/goimports@latest \
167-
github.com/mikefarah/yq/v4@v4.30.6 \
168-
github.com/golang/mock/mockgen@v1.6.0
164+
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
165+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
166+
go install golang.org/x/tools/cmd/goimports@latest
167+
go install github.com/mikefarah/yq/v4@v4.30.6
168+
go install github.com/golang/mock/mockgen@v1.6.0
169169
170170
- name: Install Protoc
171171
run: |

0 commit comments

Comments
 (0)