Skip to content

Commit 1e2e920

Browse files
authored
ci: enable go caching (#1058)
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent ed8339e commit 1e2e920

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/go-test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,24 @@ jobs:
1919
go-version: [1.24.x, 1.25.x]
2020
# We want to make sure that this builds on Linux and Darwin
2121
platform: [ubuntu-latest, macos-latest]
22+
include:
23+
- platform: ubuntu-latest
24+
cache_path: ~/.cache/go-build
25+
- platform: macos-latest
26+
cache_path: ~/Library/Caches/go-build
2227
runs-on: ${{ matrix.platform }}
2328
steps:
2429
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 https://github.com/actions/checkout/releases/tag/v6.0.0
2530
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 https://github.com/actions/setup-go/releases/tag/v6.1.0
2631
with:
2732
go-version: ${{ matrix.go-version }}
33+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0
34+
with:
35+
path: |
36+
~/go/pkg/mod
37+
${{ matrix.cache_path }}
38+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
39+
restore-keys: |
40+
${{ runner.os }}-go-${{ matrix.go-version }}-
2841
- name: go-test
2942
run: go test ./...

.github/workflows/golangci-lint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,13 @@ jobs:
1919
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 https://github.com/actions/setup-go/releases/tag/v6.1.0
2020
with:
2121
go-version: 1.24.x
22+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0
23+
with:
24+
path: |
25+
~/go/pkg/mod
26+
~/.cache/go-build
27+
key: ${{ runner.os }}-go-1.24.x-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-1.24.x-
2230
- name: golangci-lint
2331
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9.0.0 https://github.com/golangci/golangci-lint-action/releases/tag/v9.0.0

.github/workflows/nilaway.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ jobs:
1919
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 https://github.com/actions/setup-go/releases/tag/v6.1.0
2020
with:
2121
go-version: 1.25.x
22+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0
23+
with:
24+
path: |
25+
~/go/pkg/mod
26+
~/.cache/go-build
27+
key: ${{ runner.os }}-go-1.25.x-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-1.25.x-
2230
- name: install nilaway
2331
run: go install go.uber.org/nilaway/cmd/nilaway@latest
2432
- name: run nilaway

.github/workflows/publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ jobs:
8282
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 https://github.com/actions/setup-go/releases/tag/v6.1.0
8383
with:
8484
go-version: 1.24.x
85+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0
86+
with:
87+
path: |
88+
~/go/pkg/mod
89+
${{ runner.os == 'macOS' && '~/Library/Caches/go-build' || '~/.cache/go-build' }}
90+
key: ${{ runner.os }}-go-1.24.x-${{ hashFiles('**/go.sum') }}
91+
restore-keys: |
92+
${{ runner.os }}-go-1.24.x-
8593
- name: Build binary
8694
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
8795
- name: Upload release asset

0 commit comments

Comments
 (0)