Skip to content

Commit 679125f

Browse files
committed
Cache dependencies in CI workflow
1 parent 4df1e68 commit 679125f

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ jobs:
3838
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
3939
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
4040
with:
41-
go-version-file: 'go.mod'
41+
go-version-file: 'go.mod'
42+
cache: false
43+
- name: Download Go modules
44+
run: go mod download
45+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
46+
with:
47+
path: |
48+
~/.cache/go-build
49+
~/go/pkg/mod
50+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
51+
restore-keys: |
52+
${{ runner.os }}-go-
4253
- name: Setup Build Environment
4354
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
4455
- name: Build Packages
@@ -50,14 +61,6 @@ jobs:
5061
name: nginx-agent-unsigned-snapshots
5162
path: build
5263
retention-days: 1
53-
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
54-
with:
55-
path: |
56-
~/.cache/go-build
57-
~/go/pkg/mod
58-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
59-
restore-keys: |
60-
${{ runner.os }}-go-
6164

6265
lint:
6366
name: Lint
@@ -73,7 +76,8 @@ jobs:
7376
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
7477
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
7578
with:
76-
go-version-file: 'go.mod'
79+
go-version-file: 'go.mod'
80+
cache: false
7781
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
7882
with:
7983
path: |
@@ -101,7 +105,8 @@ jobs:
101105
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
102106
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
103107
with:
104-
go-version-file: 'go.mod'
108+
go-version-file: 'go.mod'
109+
cache: false
105110
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
106111
with:
107112
path: |
@@ -130,7 +135,8 @@ jobs:
130135
url: ${{ secrets.ARTIFACTORY_URL_DEV }}
131136
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
132137
with:
133-
go-version-file: 'go.mod'
138+
go-version-file: 'go.mod'
139+
cache: false
134140
- name: Run unit tests with race condition detection
135141
run: make race-condition-test
136142

@@ -158,6 +164,7 @@ jobs:
158164
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
159165
with:
160166
go-version-file: 'go.mod'
167+
cache: false
161168
- name: Download Packages
162169
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
163170
with:
@@ -207,6 +214,7 @@ jobs:
207214
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
208215
with:
209216
go-version-file: 'go.mod'
217+
cache: false
210218
- name: Download Packages
211219
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
212220
with:
@@ -263,6 +271,7 @@ jobs:
263271
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
264272
with:
265273
go-version-file: 'go.mod'
274+
cache: false
266275
- name: Download Packages
267276
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
268277
with:
@@ -329,6 +338,7 @@ jobs:
329338
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
330339
with:
331340
go-version-file: 'go.mod'
341+
cache: false
332342
- name: Download Packages
333343
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
334344
with:
@@ -394,6 +404,7 @@ jobs:
394404
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
395405
with:
396406
go-version-file: 'go.mod'
407+
cache: false
397408
- name: Download Packages
398409
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
399410
with:
@@ -460,6 +471,7 @@ jobs:
460471
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
461472
with:
462473
go-version-file: 'go.mod'
474+
cache: false
463475
- name: Download Packages
464476
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
465477
with:
@@ -511,6 +523,7 @@ jobs:
511523
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
512524
with:
513525
go-version-file: 'go.mod'
526+
cache: false
514527
- name: Run Performance Tests
515528
run: |
516529
make performance-test
@@ -542,6 +555,7 @@ jobs:
542555
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
543556
with:
544557
go-version-file: 'go.mod'
558+
cache: false
545559

546560
- name: Download Packages
547561
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0

0 commit comments

Comments
 (0)