Skip to content

Commit 643b99e

Browse files
committed
chore: Optimize Go caches in Github Actions
1 parent 938fdfd commit 643b99e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
6666
with:
6767
fetch-depth: 1
68+
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
69+
with:
70+
path: |
71+
~/.cache/go-build
72+
~/go/pkg/mod
73+
key: setup-go-${{ runner.os }}-x64-ubuntu22-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
74+
restore-keys: |
75+
setup-go-${{ runner.os }}-x64-ubuntu22-go-${{ env.GO_VERSION }}-
6876
- uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd
6977
with:
7078
languages: go
@@ -308,13 +316,8 @@ jobs:
308316
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
309317
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
310318
with:
319+
cache: false
311320
go-version: ${{ env.GO_VERSION }}
312-
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
313-
with:
314-
path: ~/go/pkg/mod
315-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
316-
restore-keys: |
317-
${{ runner.os }}-go-
318321
- name: build
319322
run: |
320323
go build ./...
@@ -390,6 +393,7 @@ jobs:
390393
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
391394
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
392395
with:
396+
cache: ${{ runner.os != 'Windows' }}
393397
go-version: stable
394398
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
395399
with:

0 commit comments

Comments
 (0)