Skip to content

Commit 956703c

Browse files
authored
CI: Update setup-go action to v4 (with automatic cache) (#2168)
1 parent 85839b0 commit 956703c

9 files changed

+32
-132
lines changed

.github/workflows/bats-hub.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,17 @@ jobs:
2727
sudo chmod +w /etc/machine-id
2828
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
2929
30-
- name: "Set up Go ${{ matrix.go-version }}"
31-
uses: actions/setup-go@v3
32-
with:
33-
go-version: ${{ matrix.go-version }}
34-
3530
- name: "Check out CrowdSec repository"
3631
uses: actions/checkout@v3
3732
with:
3833
fetch-depth: 0
3934
submodules: true
4035

41-
- name: Cache Go modules
42-
uses: actions/cache@v3
36+
- name: "Set up Go ${{ matrix.go-version }}"
37+
uses: actions/setup-go@v4
4338
with:
44-
path: |
45-
~/go/pkg/mod
46-
~/.cache/go-build
47-
~/Library/Caches/go-build
48-
%LocalAppData%\go-build
49-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
50-
restore-keys: |
51-
${{ runner.os }}-${{ matrix.go-version }}-go-
39+
go-version: ${{ matrix.go-version }}
40+
cache-dependency-path: "**/go.sum"
5241

5342
- name: "Install bats dependencies"
5443
env:

.github/workflows/bats-mysql.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,17 @@ jobs:
3434
sudo chmod +w /etc/machine-id
3535
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
3636
37-
- name: "Set up Go ${{ matrix.go-version }}"
38-
uses: actions/setup-go@v3
39-
with:
40-
go-version: ${{ matrix.go-version }}
41-
4237
- name: "Check out CrowdSec repository"
4338
uses: actions/checkout@v3
4439
with:
4540
fetch-depth: 0
4641
submodules: true
4742

48-
- name: Cache Go modules
49-
uses: actions/cache@v3
43+
- name: "Set up Go ${{ matrix.go-version }}"
44+
uses: actions/setup-go@v4
5045
with:
51-
path: |
52-
~/go/pkg/mod
53-
~/.cache/go-build
54-
~/Library/Caches/go-build
55-
%LocalAppData%\go-build
56-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
57-
restore-keys: |
58-
${{ runner.os }}-${{ matrix.go-version }}-go-
46+
go-version: ${{ matrix.go-version }}
47+
cache-dependency-path: "**/go.sum"
5948

6049
- name: "Install bats dependencies"
6150
env:

.github/workflows/bats-postgres.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,17 @@ jobs:
3535
sudo chmod +w /etc/machine-id
3636
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
3737
38-
- name: "Set up Go ${{ matrix.go-version }}"
39-
uses: actions/setup-go@v3
40-
with:
41-
go-version: ${{ matrix.go-version }}
42-
4338
- name: "Check out CrowdSec repository"
4439
uses: actions/checkout@v3
4540
with:
4641
fetch-depth: 0
4742
submodules: true
4843

49-
- name: Cache Go modules
50-
uses: actions/cache@v3
44+
- name: "Set up Go ${{ matrix.go-version }}"
45+
uses: actions/setup-go@v4
5146
with:
52-
path: |
53-
~/go/pkg/mod
54-
~/.cache/go-build
55-
~/Library/Caches/go-build
56-
%LocalAppData%\go-build
57-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
58-
restore-keys: |
59-
${{ runner.os }}-${{ matrix.go-version }}-go-
47+
go-version: ${{ matrix.go-version }}
48+
cache-dependency-path: "**/go.sum"
6049

6150
- name: "Install bats dependencies"
6251
env:

.github/workflows/bats-sqlite-coverage.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,17 @@ jobs:
2424
sudo chmod +w /etc/machine-id
2525
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
2626
27-
- name: "Set up Go ${{ matrix.go-version }}"
28-
uses: actions/setup-go@v3
29-
with:
30-
go-version: ${{ matrix.go-version }}
31-
3227
- name: "Check out CrowdSec repository"
3328
uses: actions/checkout@v3
3429
with:
3530
fetch-depth: 0
3631
submodules: true
3732

38-
- name: Cache Go modules
39-
uses: actions/cache@v3
33+
- name: "Set up Go ${{ matrix.go-version }}"
34+
uses: actions/setup-go@v4
4035
with:
41-
path: |
42-
~/go/pkg/mod
43-
~/.cache/go-build
44-
~/Library/Caches/go-build
45-
%LocalAppData%\go-build
46-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
47-
restore-keys: |
48-
${{ runner.os }}-${{ matrix.go-version }}-go-
36+
go-version: ${{ matrix.go-version }}
37+
cache-dependency-path: "**/go.sum"
4938

5039
- name: "Install bats dependencies"
5140
env:

.github/workflows/ci-windows-build-msi.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,17 @@ jobs:
3030

3131
steps:
3232

33-
- name: "Set up Go ${{ matrix.go-version }}"
34-
uses: actions/setup-go@v3
35-
with:
36-
go-version: ${{ matrix.go-version }}
37-
3833
- name: Check out code into the Go module directory
3934
uses: actions/checkout@v3
4035
with:
4136
fetch-depth: 0
4237
submodules: false
4338

44-
- name: Cache Go modules
45-
uses: actions/cache@v3
39+
- name: "Set up Go ${{ matrix.go-version }}"
40+
uses: actions/setup-go@v4
4641
with:
47-
path: |
48-
~/go/pkg/mod
49-
~/.cache/go-build
50-
~/Library/Caches/go-build
51-
%LocalAppData%\go-build
52-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
53-
restore-keys: |
54-
${{ runner.os }}-${{ matrix.go-version }}-go-
42+
go-version: ${{ matrix.go-version }}
43+
cache-dependency-path: "**/go.sum"
5544

5645
- name: Build
5746
run: make windows_installer BUILD_RE2_WASM=1

.github/workflows/docker-tests.yml

-12
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ jobs:
3030
with:
3131
config: .github/buildkit.toml
3232

33-
# - name: "Build flavor: full"
34-
# uses: docker/build-push-action@v4
35-
# with:
36-
# context: .
37-
# file: ./Dockerfile
38-
# tags: crowdsecurity/crowdsec:test
39-
# target: full
40-
# platforms: linux/amd64
41-
# load: true
42-
# cache-from: type=gha
43-
# cache-to: type=gha,mode=min
44-
4533
- name: "Build flavor: slim"
4634
uses: docker/build-push-action@v4
4735
with:

.github/workflows/go-tests-windows.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,17 @@ jobs:
2929

3030
steps:
3131

32-
- name: "Set up Go ${{ matrix.go-version }}"
33-
uses: actions/setup-go@v3
34-
with:
35-
go-version: ${{ matrix.go-version }}
36-
3732
- name: Check out CrowdSec repository
3833
uses: actions/checkout@v3
3934
with:
4035
fetch-depth: 0
4136
submodules: false
4237

43-
- name: Cache Go modules
44-
uses: actions/cache@v3
38+
- name: "Set up Go ${{ matrix.go-version }}"
39+
uses: actions/setup-go@v4
4540
with:
46-
path: |
47-
~/go/pkg/mod
48-
~/.cache/go-build
49-
~/Library/Caches/go-build
50-
%LocalAppData%\go-build
51-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
52-
restore-keys: |
53-
${{ runner.os }}-${{ matrix.go-version }}-go-
41+
go-version: ${{ matrix.go-version }}
42+
cache-dependency-path: "**/go.sum"
5443

5544
- name: Build
5645
run: |

.github/workflows/go-tests.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,17 @@ jobs:
110110
111111
steps:
112112

113-
- name: "Set up Go ${{ matrix.go-version }}"
114-
uses: actions/setup-go@v3
115-
with:
116-
go-version: ${{ matrix.go-version }}
117-
118113
- name: Check out CrowdSec repository
119114
uses: actions/checkout@v3
120115
with:
121116
fetch-depth: 0
122117
submodules: false
123118

124-
- name: Cache Go modules
125-
uses: actions/cache@v3
119+
- name: "Set up Go ${{ matrix.go-version }}"
120+
uses: actions/setup-go@v4
126121
with:
127-
path: |
128-
~/go/pkg/mod
129-
~/.cache/go-build
130-
~/Library/Caches/go-build
131-
%LocalAppData%\go-build
132-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
133-
restore-keys: |
134-
${{ runner.os }}-${{ matrix.go-version }}-go-
122+
go-version: ${{ matrix.go-version }}
123+
cache-dependency-path: "**/go.sum"
135124

136125
- name: Build and run tests, static
137126
run: |

.github/workflows/release_publish-package.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,17 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222

23-
- name: "Set up Go ${{ matrix.go-version }}"
24-
uses: actions/setup-go@v3
25-
with:
26-
go-version: ${{ matrix.go-version }}
27-
2823
- name: Check out code into the Go module directory
2924
uses: actions/checkout@v3
3025
with:
3126
fetch-depth: 0
3227
submodules: false
3328

34-
- name: Cache Go modules
35-
uses: actions/cache@v3
29+
- name: "Set up Go ${{ matrix.go-version }}"
30+
uses: actions/setup-go@v4
3631
with:
37-
path: |
38-
~/go/pkg/mod
39-
~/.cache/go-build
40-
~/Library/Caches/go-build
41-
%LocalAppData%\go-build
42-
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
43-
restore-keys: |
44-
${{ runner.os }}-${{ matrix.go-version }}-go-
32+
go-version: ${{ matrix.go-version }}
33+
cache-dependency-path: "**/go.sum"
4534

4635
- name: Build the binaries
4736
run: |

0 commit comments

Comments
 (0)