Skip to content

Commit 5b8e3c0

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

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

.github/workflows/main.yml

+10-12
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
@@ -284,9 +292,6 @@ jobs:
284292
contents: read
285293
steps:
286294
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
287-
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
288-
with:
289-
go-version: ${{ env.GO_VERSION }}
290295
- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254
291296
with:
292297
version: ${{ env.UV_VERSION }}
@@ -308,13 +313,8 @@ jobs:
308313
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
309314
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
310315
with:
316+
cache: false
311317
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-
318318
- name: build
319319
run: |
320320
go build ./...
@@ -390,6 +390,7 @@ jobs:
390390
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
391391
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
392392
with:
393+
cache: ${{ runner.os != 'Windows' }}
393394
go-version: stable
394395
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
395396
with:
@@ -456,9 +457,6 @@ jobs:
456457
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
457458
with:
458459
fetch-depth: 0
459-
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
460-
with:
461-
go-version: ${{ env.GO_VERSION }}
462460
- uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254
463461
with:
464462
version: ${{ env.UV_VERSION }}

0 commit comments

Comments
 (0)