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

Commit

Permalink
ci(circle): update CircleCI cache strategy
Browse files Browse the repository at this point in the history
Update the caching strategy in CircleCI to prevent cross-contamination 
between branches.

Also moves the `apm clean` step after `apm install` to prevent a related 
issue.
  • Loading branch information
Arcanemagus committed Feb 12, 2019
1 parent a7f612a commit 5ea3f92
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ defaults: &defaults
- run:
name: APM version
command: ${APM_SCRIPT_PATH} --version
- run:
name: Cleaning package
command: ${APM_SCRIPT_PATH} clean
- run:
name: Package APM package dependencies
command: |
Expand All @@ -31,14 +28,17 @@ defaults: &defaults
- run:
name: Package dependencies
command: ${APM_SCRIPT_PATH} install
- run:
name: Cleaning package
command: ${APM_SCRIPT_PATH} clean
- run:
name: Package specs
command: ${ATOM_SCRIPT_PATH} --test spec
# Cache node_modules
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
key: v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}

jobs:
checkout_code:
Expand All @@ -50,10 +50,15 @@ jobs:
# Restore node_modules from the last build
- restore_cache:
keys:
# Get latest cache for this package.json
- v1-dependencies-{{ checksum "package.json" }}
# Fallback to the last available cache
- v1-dependencies
# Get latest cache for this package.json and package-lock.json
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
# Fallback to the current package.json
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-
# Fallback to the last build for this branch
- v1-dependencies-{{ .Branch }}-
# Fallback to the last available master branch cache
- v1-dependencies-master-
# Don't go further down to prevent dependency issues from other branches
# Save project state for next steps
- persist_to_workspace:
root: /tmp
Expand Down

0 comments on commit 5ea3f92

Please sign in to comment.