Skip to content

CircleCI: improve caching for faster startup time #3612

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

Merged
merged 2 commits into from
Mar 7, 2019
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
39 changes: 12 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ jobs:
working_directory: ~/plotly.js
steps:
- checkout
- restore_cache:
keys:
- v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "package-lock.json" }}
Copy link
Contributor Author

@antoinerg antoinerg Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice here we use the checksum of "package-lock.json" but when we save the cache, we use the checksum of "package.json". Those two cache names will never match so this is why I removed this "dead" code.

- v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-master-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: |
npm install
npm ci
- run:
name: List dependency versions
command: |
Expand All @@ -33,26 +29,21 @@ jobs:
command: |
npm run pretest
npm run cibuild
- save_cache:
paths:
- node_modules
key: v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "package.json" }}
- run:
command: rm -rf .git
- persist_to_workspace:
root: .
root: /home/circleci
paths:
- node_modules
- build
- dist
- plotly.js

test-jasmine:
docker:
# need '-browsers' version to test in real (xvfb-wrapped) browsers
- image: circleci/node:10.9.0-browsers
working_directory: ~/plotly.js
steps:
- checkout
- attach_workspace:
at: ~/plotly.js
at: ~/
- run:
name: Run jasmine tests (batch 1)
command: ./.circleci/test.sh jasmine
Expand All @@ -63,9 +54,8 @@ jobs:
- image: circleci/node:10.9.0-browsers
working_directory: ~/plotly.js
steps:
- checkout
- attach_workspace:
at: ~/plotly.js
at: ~/
- run:
name: Run jasmine tests (batch 2)
command: ./.circleci/test.sh jasmine2
Expand All @@ -76,9 +66,8 @@ jobs:
- image: circleci/node:10.9.0-browsers
working_directory: ~/plotly.js
steps:
- checkout
- attach_workspace:
at: ~/plotly.js
at: ~/
- run:
name: Run jasmine tests (batch 3)
command: ./.circleci/test.sh jasmine3
Expand All @@ -88,9 +77,8 @@ jobs:
- image: plotly/testbed:latest
working_directory: /var/www/streambed/image_server/plotly.js/
steps:
- checkout
- attach_workspace:
at: /var/www/streambed/image_server/plotly.js/
at: /var/www/streambed/image_server/
- run:
name: Run and setup container
command: |
Expand All @@ -108,9 +96,8 @@ jobs:
- image: plotly/testbed:latest
working_directory: /var/www/streambed/image_server/plotly.js/
steps:
- checkout
- attach_workspace:
at: /var/www/streambed/image_server/plotly.js/
at: /var/www/streambed/image_server/
- run:
name: Run and setup container
command: |
Expand All @@ -128,9 +115,8 @@ jobs:
- image: circleci/node:10.9.0
working_directory: ~/plotly.js
steps:
- checkout
- attach_workspace:
at: ~/plotly.js
at: ~/
- run:
name: Run syntax tests
command: ./.circleci/test.sh syntax
Expand All @@ -140,9 +126,8 @@ jobs:
- image: circleci/node:10.9.0
working_directory: ~/plotly.js
steps:
- checkout
- attach_workspace:
at: ~/plotly.js
at: ~/
- run:
name: Build dist/
command: npm run build
Expand Down