Skip to content

Commit 076db31

Browse files
authored
ci: use actions/setup-go builtin cache (#10608)
1 parent ad3abe3 commit 076db31

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

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

-46
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,11 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11-
- name: Cache go toolchain
12-
uses: buildjet/cache@v3
13-
with:
14-
path: |
15-
${{ runner.tool_cache }}/go/${{ inputs.version }}
16-
key: gotoolchain-${{ runner.os }}-${{ inputs.version }}
17-
restore-keys: |
18-
gotoolchain-${{ runner.os }}-
19-
2011
- name: Setup Go
2112
uses: buildjet/setup-go@v4
2213
with:
23-
# We do our own caching for implementation clarity.
24-
cache: false
2514
go-version: ${{ inputs.version }}
2615

27-
- name: Get cache dirs
28-
shell: bash
29-
run: |
30-
set -x
31-
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
32-
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
33-
34-
# We split up GOMODCACHE from GOCACHE because the latter must be invalidated
35-
# on code change, but the former can be kept.
36-
- name: Cache $GOMODCACHE
37-
uses: buildjet/cache@v3
38-
with:
39-
path: |
40-
${{ env.GOMODCACHE }}
41-
key: gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}
42-
# restore-keys aren't used because it causes the cache to grow
43-
# infinitely. go.sum changes very infrequently, so rebuilding from
44-
# scratch every now and then isn't terrible.
45-
46-
- name: Cache $GOCACHE
47-
uses: buildjet/cache@v3
48-
with:
49-
path: |
50-
${{ env.GOCACHE }}
51-
# Job name must be included in the key for effective test cache reuse.
52-
# The key format is intentionally different than GOMODCACHE, because any
53-
# time a Go file changes we invalidate this cache, whereas GOMODCACHE is
54-
# only invalidated when go.sum changes.
55-
# The number in the key is incremented when the cache gets too large,
56-
# since this technically grows without bound.
57-
key: gocache2-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
58-
restore-keys: |
59-
gocache2-${{ runner.os }}-${{ github.job }}-
60-
gocache2-${{ runner.os }}-
61-
6216
- name: Install gotestsum
6317
shell: bash
6418
run: go install gotest.tools/gotestsum@latest

0 commit comments

Comments
 (0)