Skip to content

Commit 4f14522

Browse files
[8.19] (backport #16788) ci: use manual caching with actions/cache (#16791)
* 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 * Update ci.yml --------- Co-authored-by: kruskall <[email protected]>
1 parent 6cd238a commit 4f14522

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

.github/workflows/ci.yml

+34-22
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,19 +49,19 @@ 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
56-
cache: true
57-
- env:
58-
CGO_ENABLED: "0"
59-
run: go test -v ./...
55+
cache: false
56+
- uses: actions/[email protected]
57+
with:
58+
enableCrossOsArchive: true
59+
path: |
60+
~/go/pkg/mod/cache
61+
key: go-${{ hashFiles('go.mod') }}
62+
restore-keys: |
63+
go-
64+
- run: go test -v -race ./...
6065

6166
test-fips:
6267
runs-on: ubuntu-latest
@@ -65,7 +70,14 @@ jobs:
6570
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
6671
with:
6772
go-version-file: go.mod
68-
cache: true
73+
cache: false
74+
- uses: actions/[email protected]
75+
with:
76+
path: |
77+
~/go/pkg/mod/cache
78+
key: go-${{ hashFiles('go.mod') }}
79+
restore-keys: |
80+
go-
6981
- env:
7082
CGO_ENABLED: "0"
7183
GOFIPS140: "latest"
@@ -79,11 +91,15 @@ jobs:
7991
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
8092
with:
8193
go-version-file: systemtest/go.mod
82-
cache: true
83-
cache-dependency-path: |
84-
go.sum
85-
systemtest/go.sum
94+
cache: false
8695
- run: docker compose up -d
96+
- uses: actions/[email protected]
97+
with:
98+
path: |
99+
~/go/pkg/mod/cache
100+
key: systemtest-go-${{ hashFiles('systemtest/go.mod', 'go.mod') }}
101+
restore-keys: |
102+
systemtest-go-
87103
- env:
88104
GOTESTFLAGS: "-v"
89105
GH_TOKEN: ${{ github.token }}
@@ -97,8 +113,6 @@ jobs:
97113
with:
98114
go-version-file: go.mod
99115
cache: false
100-
cache-dependency-path: |
101-
go.sum
102116
- run: make package-snapshot
103117
env:
104118
GH_TOKEN: ${{ github.token }}
@@ -115,8 +129,6 @@ jobs:
115129
with:
116130
go-version-file: go.mod
117131
cache: false
118-
cache-dependency-path: |
119-
go.sum
120132
- name: Log in to the Elastic Container registry
121133
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
122134
with:

0 commit comments

Comments
 (0)