Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(circle): Fix cache key setup for proper node_modules sharing #5060

Merged
merged 3 commits into from
Dec 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,27 @@ attach_workspace: &attach_workspace
attach_workspace:
at: ~/project

restore_cache: &restore_cache
restore_cache:
name: Restore node_modules cache
keys:
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-node-{{ arch }}-{{ .Branch }}-
- v1-node-{{ arch }}-

install_steps: &install_steps
steps:
- checkout
- *attach_workspace
- *restore_cache
- restore_cache:
name: Restore node_modules cache
keys:
# WARNING: add `{{ arch }}` into the keys below and separate the installation steps
# for Linux and macOS if you ever need platform-specific dependencies
# (anything using node-gyp etc.)
- v2-node-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v2-node-{{ .Branch }}-
- v2-node-
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save node_modules cache
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
key: v2-node-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run:
name: Remove node_modules to cleanup workspace
command: rm -r node_modules/
- persist_to_workspace:
root: ~/project
paths:
Expand All @@ -62,7 +59,6 @@ test_run: &test_run
test_steps: &test_steps
steps:
- *attach_workspace
- *restore_cache
- *test_build
- *test_run

Expand All @@ -78,15 +74,13 @@ jobs:
<<: *docker_defaults
steps:
- *attach_workspace
- *restore_cache
- run:
name: Lint
command: yarn lint
build:
<<: *docker_defaults
steps:
- *attach_workspace
- *restore_cache
- run:
name: Build distribution
command: |
Expand Down Expand Up @@ -125,7 +119,6 @@ jobs:
HOMEBREW_NO_AUTO_UPDATE=1 brew install node@8
yarn global add node-gyp
- *attach_workspace
- *restore_cache
- *test_build
- *test_run
test-macos-node6:
Expand All @@ -139,15 +132,13 @@ jobs:
brew link --force node@6
yarn global add node-gyp
- *attach_workspace
- *restore_cache
- *test_build
- *test_run

publish:
<<: *docker_defaults
steps:
- *attach_workspace
- *restore_cache
- run:
name: Publish
command: |
Expand Down