Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 5070596

Browse files
committed
ci(circle): update caching strategy
1 parent d0e691f commit 5070596

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.circleci/config.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ defaults: &defaults
6060
- save_cache:
6161
paths:
6262
- node_modules
63-
key: v1-dependencies-{{ checksum "package.json" }}
63+
key: v2-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
6464

6565
jobs:
6666
checkout_code:
@@ -72,10 +72,15 @@ jobs:
7272
# Restore node_modules from the last build
7373
- restore_cache:
7474
keys:
75-
# Get latest cache for this package.json
76-
- v1-dependencies-{{ checksum "package.json" }}
77-
# Fallback to the last available cache
78-
- v1-dependencies
75+
# Get latest cache for this package.json and pacakge-lock.json
76+
- v2-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
77+
# Fallback to the current package.json
78+
- v2-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-
79+
# Fallback to the last build for this branch
80+
- v2-dependencies-{{ .Branch }}-
81+
# Fallback to the last available master branch cache
82+
- v2-dependencies-master-
83+
# Don't go further down to prevent dependency issues from other branches
7984
# Save project state for next steps
8085
- persist_to_workspace:
8186
root: /tmp

0 commit comments

Comments
 (0)