ci: share yarn cache on Circle

On a cache miss, `yarn install` via `make node_modules` takes about 42
seconds, plus about 19 seconds to upload the cache. See
https://circleci.com/gh/influxdata/platform/1872.

On a cache hit, `make node_modules` takes about 7 seconds to download
the cache plus 19 seconds to `yarn install`. See
https://circleci.com/gh/influxdata/platform/1877. Using the cache here
is a net gain of about 16 seconds on cache hit, which is the most likely
case given a random commit.
pull/10616/head
Mark Rushakoff 2018-08-28 14:20:46 -07:00 committed by Mark Rushakoff
parent 5b4506db1d
commit 8a6749fc1c
1 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,21 @@ jobs:
working_directory: /go/src/github.com/influxdata/platform working_directory: /go/src/github.com/influxdata/platform
steps: steps:
- checkout - checkout
# Run yarn install, using Circle's cache if applicable.
- restore_cache:
name: Restore Yarn package cache
keys:
# Only cache on exact yarn.lock match, as in Circle's yarn example:
# https://circleci.com/docs/2.0/yarn/
- chronograf-yarn-packages-{{ checksum "chronograf/ui/yarn.lock" }}
- run: make node_modules
- save_cache:
name: Save Yarn package cache
key: chronograf-yarn-packages-{{ checksum "chronograf/ui/yarn.lock" }}
paths:
- ~/.cache/yarn
- run: make test-js - run: make test-js
gotest: gotest: