Skip to content

Commit 682243a

Browse files
kruskallmergify[bot]
authored andcommitted
ci: use manual caching with actions/cache (#16788)
* ci: use manual caching with actions/cache use os agnostic cache key only cache pkg mod cache * ci: enable enableCrossOsArchive by default cache won't be shared across os enable it so we can reuse the go module cache (cherry picked from commit bac9fec) # Conflicts: # .github/workflows/ci.yml
1 parent 6cd238a commit 682243a

File tree

1 file changed

+79
-18
lines changed

1 file changed

+79
-18
lines changed

.github/workflows/ci.yml

+79-18
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ jobs:
3232
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
3333
with:
3434
go-version-file: go.mod
35-
cache: true
36-
cache-dependency-path: |
37-
go.sum
35+
cache: false
36+
- uses: actions/[email protected]
37+
with:
38+
path: |
39+
~/go/pkg/mod/cache
40+
key: go-${{ hashFiles('go.mod') }}
41+
restore-keys: |
42+
go-
3843
- run: make check-full
3944

4045
test:
@@ -44,16 +49,39 @@ jobs:
4449
runs-on: ${{ matrix.os }}
4550
steps:
4651
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
47-
- uses: antontroshin/setup-go@bda02de8887c9946189f81e7e59512914aeb9ea4 # bda02de8887c9946189f81e7e59512914aeb9ea4
48-
if: runner.os == 'Windows'
49-
with:
50-
go-version-file: go.mod
51-
cache: true
5252
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
53-
if: runner.os != 'Windows'
5453
with:
5554
go-version-file: go.mod
55+
<<<<<<< HEAD
5656
cache: true
57+
=======
58+
cache: false
59+
- uses: actions/[email protected]
60+
with:
61+
enableCrossOsArchive: true
62+
path: |
63+
~/go/pkg/mod/cache
64+
key: go-${{ hashFiles('go.mod') }}
65+
restore-keys: |
66+
go-
67+
- run: go test -v -race ./...
68+
69+
functional-test:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/[email protected]
73+
- uses: actions/[email protected]
74+
with:
75+
go-version-file: functionaltests/go.mod
76+
cache: false
77+
- uses: actions/[email protected]
78+
with:
79+
path: |
80+
~/go/pkg/mod/cache
81+
key: functionaltests-go-${{ hashFiles('functionaltests/go.mod') }}
82+
restore-keys: |
83+
functionaltests-go-
84+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
5785
- env:
5886
CGO_ENABLED: "0"
5987
run: go test -v ./...
@@ -65,7 +93,14 @@ jobs:
6593
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
6694
with:
6795
go-version-file: go.mod
68-
cache: true
96+
cache: false
97+
- uses: actions/[email protected]
98+
with:
99+
path: |
100+
~/go/pkg/mod/cache
101+
key: go-${{ hashFiles('go.mod') }}
102+
restore-keys: |
103+
go-
69104
- env:
70105
CGO_ENABLED: "0"
71106
GOFIPS140: "latest"
@@ -79,16 +114,46 @@ jobs:
79114
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
80115
with:
81116
go-version-file: systemtest/go.mod
82-
cache: true
83-
cache-dependency-path: |
84-
go.sum
85-
systemtest/go.sum
117+
cache: false
86118
- run: docker compose up -d
119+
- uses: actions/[email protected]
120+
with:
121+
path: |
122+
~/go/pkg/mod/cache
123+
key: systemtest-go-${{ hashFiles('systemtest/go.mod', 'go.mod') }}
124+
restore-keys: |
125+
systemtest-go-
87126
- env:
88127
GOTESTFLAGS: "-v"
89128
GH_TOKEN: ${{ github.token }}
90129
run: make system-test
91130

131+
<<<<<<< HEAD
132+
=======
133+
system-test-fips:
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@v4
137+
- uses: actions/setup-go@v5
138+
with:
139+
go-version-file: systemtest/go.mod
140+
cache: false
141+
- run: docker compose up -d
142+
- uses: actions/[email protected]
143+
with:
144+
path: |
145+
~/go/pkg/mod/cache
146+
key: systemtest-go-${{ hashFiles('systemtest/go.mod', 'go.mod') }}
147+
restore-keys: |
148+
systemtest-go-
149+
- env:
150+
GOTESTFLAGS: "-v -tags=requirefips"
151+
GOFIPS140: "latest"
152+
GODEBUG: "fips140=only"
153+
GH_TOKEN: ${{ github.token }}
154+
run: make system-test
155+
156+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
92157
test-package:
93158
runs-on: ubuntu-latest
94159
steps:
@@ -97,8 +162,6 @@ jobs:
97162
with:
98163
go-version-file: go.mod
99164
cache: false
100-
cache-dependency-path: |
101-
go.sum
102165
- run: make package-snapshot
103166
env:
104167
GH_TOKEN: ${{ github.token }}
@@ -115,8 +178,6 @@ jobs:
115178
with:
116179
go-version-file: go.mod
117180
cache: false
118-
cache-dependency-path: |
119-
go.sum
120181
- name: Log in to the Elastic Container registry
121182
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
122183
with:

0 commit comments

Comments
 (0)