diff --git a/.circleci/config.yml b/.circleci/config.yml index dbfd56f..6713073 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,86 @@ + +executors: + node: + docker: + - image: circleci/node:8 + +aliases: + restore_cache: &restore_cache + restore_cache: + name: Restore Npm Package Cache + keys: + - yarn-cache-netlify-{{ checksum "yarn.lock" }} + + install_node_modules: &install_node_modules + run: + name: Install dependencies + command: yarn + + save_cache: &save_cache + save_cache: + name: Save NPM package cache + key: yarn-cache-netlify-{{ checksum "yarn.lock" }} + paths: + - ./node_modules + version: 2.1 -orbs: - node: circleci/node@3.0.0 + +jobs: + test: + executor: node + steps: + - checkout + - <<: *restore_cache + - <<: *install_node_modules + - <<: *save_cache + - run: + name: Test + command: yarn test + + build: + executor: node + steps: + - checkout + - <<: *restore_cache + - <<: *install_node_modules + - run: + name: Build + command: yarn build + - persist_to_workspace: + root: ./ + paths: + - public + + deploy: + executor: node + steps: + - checkout + - attach_workspace: + at: ./ + - <<: *restore_cache + - <<: *install_node_modules + - run: + name: Install netlify-cli + command: sudo npm install -g --silent netlify-cli + - run: + name: Deploy to Netlify + command: netlify deploy --dir=./public -p + workflows: - node-tests: + version: 2 + build_and_deploy: jobs: - - node/test + - test: + filters: + branches: + ignore: + - gh-pages + - build: + requires: + - test + - deploy: + requires: + - build + filters: + branches: + only: master