Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cache toolchain
  • Loading branch information
ammario committed Jun 10, 2023
commit d2909e8f7a4854bcc103b77a9493f54cf0b7c09b
23 changes: 18 additions & 5 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
name: "Setup Go"
description: |
Sets up the Go environment for tests, builds, etc.
inputs:
version:
description: "The Go version to use."
default: "1.20.5"
runs:
using: "composite"
steps:
- name: Cache go toolchain
uses: buildjet/cache@v3
with:
path: |
${{ env.RUNNER_TOOL_CACHE }}/go/${{ inputs.version }}
key: gotoolchain-${{ runner.os }}-${{ inputs.version }}
restore-keys: |
gotoolchain-${{ runner.os }}-

- uses: buildjet/setup-go@v4
with:
# We do our own caching for implementation clarity.
cache: false
go-version: "1.20.5"
go-version: ${{ inputs.version }}

- name: Cache go
uses: buildjet/cache@v3
Expand All @@ -21,11 +34,11 @@ runs:
~/Library/Caches/go-build
# Job name must be included in the key for effective
# test cache reuse.
key: go-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
key: gocache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
restore-keys: |
go-${{ runner.os }}-${{ github.job }}-
go-${{ runner.os }}-
go-
gocache-${{ runner.os }}-${{ github.job }}-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyphen at the end?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was on purpose. It's how I've seen it done on a few docs. I guess it clearly symbolizes the end of a token.

gocache-${{ runner.os }}-
gocache-

- name: Install gotestsum
uses: jaxxstorm/action-install-gh-release@v1.10.0
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ jobs:

- name: go install tools
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30 \
storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33 \
golang.org/x/tools/cmd/goimports@latest \
github.com/mikefarah/yq/v4@v4.30.6 \
github.com/golang/mock/mockgen@v1.6.0
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/mikefarah/yq/v4@v4.30.6
go install github.com/golang/mock/mockgen@v1.6.0

- name: Install Protoc
run: |
Expand Down