Skip to content

Commit d4421f5

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 78351ec commit d4421f5

File tree

1 file changed

+96
-1
lines changed

1 file changed

+96
-1
lines changed

.github/workflows/ci.yml

+96-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,21 @@ jobs:
3131
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
3232
with:
3333
go-version-file: go.mod
34+
<<<<<<< HEAD
3435
cache: true
3536
cache-dependency-path: |
3637
go.sum
3738
tools/go.sum
39+
=======
40+
cache: false
41+
- uses: actions/[email protected]
42+
with:
43+
path: |
44+
~/go/pkg/mod/cache
45+
key: go-${{ hashFiles('go.mod') }}
46+
restore-keys: |
47+
go-
48+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
3849
- run: make check-full
3950
- name: Ensure .go-version is up to date
4051
run: make update-go-version
@@ -47,10 +58,64 @@ jobs:
4758
runs-on: ${{ matrix.os }}
4859
steps:
4960
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
61+
<<<<<<< HEAD
62+
=======
5063
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
5164
with:
5265
go-version-file: go.mod
53-
cache: true
66+
cache: false
67+
- uses: actions/[email protected]
68+
with:
69+
enableCrossOsArchive: true
70+
path: |
71+
~/go/pkg/mod/cache
72+
key: go-${{ hashFiles('go.mod') }}
73+
restore-keys: |
74+
go-
75+
- run: go test -v -race ./...
76+
77+
functional-test:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/[email protected]
81+
- uses: actions/[email protected]
82+
with:
83+
go-version-file: functionaltests/go.mod
84+
cache: false
85+
- uses: actions/[email protected]
86+
with:
87+
path: |
88+
~/go/pkg/mod/cache
89+
key: functionaltests-go-${{ hashFiles('functionaltests/go.mod') }}
90+
restore-keys: |
91+
functionaltests-go-
92+
- env:
93+
KIBANA_URL: "https://kibana.test"
94+
KIBANA_USERNAME: "dummy"
95+
KIBANA_PASSWORD: "dummy"
96+
EC_URL: "https://elastic-cloud.test"
97+
EC_API_KEY: "dummy"
98+
EC_REGION: "gcp-us-west2"
99+
# run functionaltests internal tests
100+
# functionaltests themselves are run in the functional-tests pipeline
101+
run: cd ./functionaltests && go test -v -race ./internal/...
102+
103+
test-fips:
104+
runs-on: ubuntu-latest
105+
steps:
106+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
107+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
108+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
109+
with:
110+
go-version-file: go.mod
111+
cache: false
112+
- uses: actions/[email protected]
113+
with:
114+
path: |
115+
~/go/pkg/mod/cache
116+
key: go-${{ hashFiles('go.mod') }}
117+
restore-keys: |
118+
go-
54119
- env:
55120
CGO_ENABLED: "0"
56121
run: go test -v ./...
@@ -62,8 +127,19 @@ jobs:
62127
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
63128
with:
64129
go-version-file: systemtest/go.mod
130+
<<<<<<< HEAD
65131
cache: true
132+
=======
133+
cache: false
134+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
66135
- run: docker compose up -d
136+
- uses: actions/[email protected]
137+
with:
138+
path: |
139+
~/go/pkg/mod/cache
140+
key: systemtest-go-${{ hashFiles('systemtest/go.mod', 'go.mod') }}
141+
restore-keys: |
142+
systemtest-go-
67143
- env:
68144
GOTESTFLAGS: "-v -json"
69145
OUTPUT_JSON_FILE: "build/TEST-go-system_tests.out.json"
@@ -76,8 +152,27 @@ jobs:
76152
- uses: actions/upload-artifact@v4 # upload test results
77153
if: ${{ always() }} # run this step even if previous step failed
78154
with:
155+
<<<<<<< HEAD
79156
name: test-results
80157
path: 'build/*.xml'
158+
=======
159+
go-version-file: systemtest/go.mod
160+
cache: false
161+
- run: docker compose up -d
162+
- uses: actions/[email protected]
163+
with:
164+
path: |
165+
~/go/pkg/mod/cache
166+
key: systemtest-go-${{ hashFiles('systemtest/go.mod', 'go.mod') }}
167+
restore-keys: |
168+
systemtest-go-
169+
- env:
170+
GOTESTFLAGS: "-v -tags=requirefips"
171+
GOFIPS140: "latest"
172+
GODEBUG: "fips140=only"
173+
GH_TOKEN: ${{ github.token }}
174+
run: make system-test
175+
>>>>>>> bac9fec6 (ci: use manual caching with actions/cache (#16788))
81176

82177
test-package:
83178
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)