Skip to content

Commit f1036d5

Browse files
authored
CICD: Optimizing CircleCI cache usage (#4087)
1 parent 5838f72 commit f1036d5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

.circleci/config.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ commands:
217217
- restore_libsodium
218218
- restore_cache:
219219
keys:
220-
- 'go-mod-1-14-7-v2-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
220+
- 'go-mod-1.17.9-v3-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
221221
- restore_cache:
222222
keys:
223-
- 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-'
223+
- 'go-cache-v3-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
224+
- 'go-cache-v3-{{ arch }}-{{ .Branch }}-'
225+
- 'go-cache-v3-{{ arch }}-'
224226
- run:
225227
name: scripts/travis/build.sh --make_debug
226228
command: |
@@ -233,11 +235,11 @@ commands:
233235
scripts/travis/build.sh --make_debug
234236
- cache_libsodium
235237
- save_cache:
236-
key: 'go-mod-1-14-7-v2-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
238+
key: 'go-mod-1.17.9-v3-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
237239
paths:
238240
- << parameters.build_dir >>/go/pkg/mod
239241
- save_cache:
240-
key: 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-{{ .Environment.CIRCLE_BUILD_NUM }}'
242+
key: 'go-cache-v3-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
241243
paths:
242244
- tmp/go-cache
243245
- persist_to_workspace:
@@ -257,7 +259,7 @@ commands:
257259
mkdir -p tmp
258260
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
259261
- save_cache:
260-
key: 'libsodium-fork-v2-{{ .Environment.CIRCLE_STAGE }}-{{ checksum "tmp/libsodium.md5" }}'
262+
key: 'libsodium-fork-v2-{{ arch }}-{{ checksum "tmp/libsodium.md5" }}'
261263
paths:
262264
- crypto/libs
263265

@@ -271,7 +273,7 @@ commands:
271273
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
272274
- restore_cache:
273275
keys:
274-
- 'libsodium-fork-v2-{{ .Environment.CIRCLE_STAGE }}-{{ checksum "tmp/libsodium.md5" }}'
276+
- 'libsodium-fork-v2-{{ arch }}-{{ checksum "tmp/libsodium.md5" }}'
275277

276278
generic_test:
277279
description: Run build tests from build workspace, for re-use by diferent architectures
@@ -301,7 +303,9 @@ commands:
301303
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
302304
- restore_cache:
303305
keys:
304-
- 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-'
306+
- 'go-cache-v3-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
307+
- 'go-cache-v3-{{ arch }}-{{ .Branch }}-'
308+
- 'go-cache-v3-{{ arch }}-'
305309
- run:
306310
name: Run build tests
307311
no_output_timeout: << parameters.no_output_timeout >>
@@ -333,10 +337,6 @@ commands:
333337
root: << parameters.result_path >>
334338
paths:
335339
- << parameters.result_subdir >>
336-
- save_cache:
337-
key: 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-{{ .Environment.CIRCLE_BUILD_NUM }}'
338-
paths:
339-
- tmp/go-cache
340340

341341
upload_coverage:
342342
description: Collect coverage reports and upload them

0 commit comments

Comments
 (0)