Skip to content

Commit

Permalink
Use CircleCI Workspaces to speed up workflow startups (#689)
Browse files Browse the repository at this point in the history
* Replace repeated restore_cache with workspaces

* Fall back to master yarn cache
  • Loading branch information
kitten authored Apr 9, 2020
1 parent 72ca9cf commit 5a34b9e
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,39 @@ executors:
- image: circleci/node:12-buster

aliases:
- &yarn_cache
restore_cache:
name: Restore Yarn cache
keys:
- yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-{{ .Branch }}-
- &yarn
run:
name: Install Packages
command: yarn --frozen-lockfile --non-interactive
- &node_modules
attach_workspace:
at: .

jobs:
setup:
executor: node
steps:
- checkout
- *yarn_cache
- *yarn
- restore_cache:
name: Restore Yarn cache
keys:
- yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-{{ .Branch }}-
- yarn-master-
- run:
name: Install Packages
command: yarn --frozen-lockfile --non-interactive
- save_cache:
name: Save Yarn cache
key: yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths:
- node_modules

check:
executor: node
steps:
- checkout
- *yarn_cache
- *yarn
- *node_modules
- run:
name: TypeScript
command: yarn run check
Expand All @@ -51,8 +54,7 @@ jobs:
parallelism: 4
steps:
- checkout
- *yarn_cache
- *yarn
- *node_modules
- run:
name: Build
command: yarn run build
Expand All @@ -61,8 +63,7 @@ jobs:
executor: node
steps:
- checkout
- *yarn_cache
- *yarn
- *node_modules
- run:
name: Build Staging Site
command: |
Expand All @@ -81,8 +82,7 @@ jobs:
name: Install AWS CLI
command: sudo apt-get -y -qq install awscli
- checkout
- *yarn_cache
- *yarn
- *node_modules
- run:
name: Build Production Site
command: |
Expand Down

0 comments on commit 5a34b9e

Please sign in to comment.