Skip to content

Commit 9b2660f

Browse files
authored
Use cached tools instead of uploading to the artifacts (#2475)
Updates #1234 Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 3b564a9 commit 9b2660f

File tree

1 file changed

+51
-44
lines changed

1 file changed

+51
-44
lines changed

.github/workflows/build-and-test.yml

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,31 @@ jobs:
5252
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
5353
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
5454
- name: Cache Go Modules
55+
id: module-cache
5556
uses: actions/cache@v2
5657
env:
5758
cache-name: cache-go-modules
5859
with:
5960
path: /home/runner/go/pkg/mod
60-
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }}
61-
- name: Restore tools binaries
61+
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod') }}
62+
- name: Download dependencies
63+
if: steps.module-cache.outputs.cache-hit != 'true'
64+
run: go mod download
65+
- name: Cache Tools
6266
id: tool-cache
6367
uses: actions/cache@v2
6468
env:
6569
cache-name: cache-tool-binaries
6670
with:
6771
path: /home/runner/go/bin
68-
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
69-
- name: Install tools
72+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
73+
- name: Install Tools
7074
if: steps.tool-cache.outputs.cache-hit != 'true'
7175
run: make install-tools
7276
- name: Split Loadtest Jobs
7377
id: splitloadtest
7478
run: ./.github/workflows/scripts/setup_load_tests.sh
75-
- name: Upload Tool Binaries
76-
uses: actions/upload-artifact@v1
77-
with:
78-
name: tool-binaries
79-
path: /home/runner/go/bin
79+
8080
lint:
8181
runs-on: ubuntu-latest
8282
needs: [setup-environment]
@@ -98,13 +98,14 @@ jobs:
9898
with:
9999
path: /home/runner/go/pkg/mod
100100
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }}
101-
- name: Download Tool Binaries
102-
uses: actions/download-artifact@v1
101+
- name: Cache Tools
102+
id: tool-cache
103+
uses: actions/cache@v2
104+
env:
105+
cache-name: cache-tool-binaries
103106
with:
104-
name: tool-binaries
105107
path: /home/runner/go/bin
106-
- name: Add Permissions to Tool Binaries
107-
run: chmod -R +x /home/runner/go/bin
108+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
108109
- name: Lint
109110
run: make -j4 gochecklicense goimpi golint gomisspell
110111
- name: Gen Metadata
@@ -136,13 +137,14 @@ jobs:
136137
with:
137138
path: /home/runner/go/pkg/mod
138139
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }}
139-
- name: Download Tool Binaries
140-
uses: actions/download-artifact@v1
140+
- name: Cache Tools
141+
id: tool-cache
142+
uses: actions/cache@v2
143+
env:
144+
cache-name: cache-tool-binaries
141145
with:
142-
name: tool-binaries
143146
path: /home/runner/go/bin
144-
- name: Add Permissions to Tool Binaries
145-
run: chmod -R +x /home/runner/go/bin
147+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
146148
- name: Build Collector for All Architectures
147149
run: grep ^binaries-all-sys Makefile|fmt -w 1|tail -n +2|xargs make
148150
- name: Create Collector Binaries Archive
@@ -176,13 +178,14 @@ jobs:
176178
with:
177179
path: /home/runner/go/pkg/mod
178180
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }}
179-
- name: Download Tool Binaries
180-
uses: actions/download-artifact@v1
181+
- name: Cache Tools
182+
id: tool-cache
183+
uses: actions/cache@v2
184+
env:
185+
cache-name: cache-tool-binaries
181186
with:
182-
name: tool-binaries
183187
path: /home/runner/go/bin
184-
- name: Add Permissions to Tool Binaries
185-
run: chmod -R +x /home/runner/go/bin
188+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
186189
- name: Install fluentbit
187190
if: ${{ contains(matrix.test, 'Log10kDPS') }}
188191
run: |
@@ -231,13 +234,14 @@ jobs:
231234
with:
232235
path: /home/runner/go/pkg/mod
233236
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('./go.mod') }}
234-
- name: Download Tool Binaries
235-
uses: actions/download-artifact@v1
237+
- name: Cache Tools
238+
id: tool-cache
239+
uses: actions/cache@v2
240+
env:
241+
cache-name: cache-tool-binaries
236242
with:
237-
name: tool-binaries
238243
path: /home/runner/go/bin
239-
- name: Add Permissions to Tool Binaries
240-
run: chmod -R +x /home/runner/go/bin
244+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
241245
- name: Loadtest
242246
run: make testbed-correctness
243247
- name: GitHub Issue Generator
@@ -271,13 +275,14 @@ jobs:
271275
ruby-version: '2.6'
272276
- name: Install fpm
273277
run: gem install --no-document fpm -v 1.11.0
274-
- name: Download Tool Binaries
275-
uses: actions/download-artifact@v1
278+
- name: Cache Tools
279+
id: tool-cache
280+
uses: actions/cache@v2
281+
env:
282+
cache-name: cache-tool-binaries
276283
with:
277-
name: tool-binaries
278284
path: /home/runner/go/bin
279-
- name: Add Permissions to Tool Binaries
280-
run: chmod -R +x /home/runner/go/bin
285+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
281286
- name: Download Collector Binaries
282287
uses: actions/download-artifact@v1
283288
with:
@@ -362,13 +367,14 @@ jobs:
362367
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
363368
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
364369
mkdir bin/ dist/
365-
- name: Download Tool Binaries
366-
uses: actions/download-artifact@v1
370+
- name: Cache Tools
371+
id: tool-cache
372+
uses: actions/cache@v2
373+
env:
374+
cache-name: cache-tool-binaries
367375
with:
368-
name: tool-binaries
369376
path: /home/runner/go/bin
370-
- name: Add Permissions to Tool Binaries
371-
run: chmod -R +x /home/runner/go/bin
377+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
372378
- name: Download Binaries
373379
uses: actions/download-artifact@v1
374380
with:
@@ -421,13 +427,14 @@ jobs:
421427
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
422428
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
423429
mkdir bin/ dist/
424-
- name: Download Tool Binaries
425-
uses: actions/download-artifact@v1
430+
- name: Cache Tools
431+
id: tool-cache
432+
uses: actions/cache@v2
433+
env:
434+
cache-name: cache-tool-binaries
426435
with:
427-
name: tool-binaries
428436
path: /home/runner/go/bin
429-
- name: Add Permissions to Tool Binaries
430-
run: chmod -R +x /home/runner/go/bin
437+
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
431438
- name: Download Binaries
432439
uses: actions/download-artifact@v1
433440
with:

0 commit comments

Comments
 (0)