From 0d1aec13ba9dd5126bcd132361564139e59a8293 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Wed, 7 Aug 2019 18:09:01 -0300 Subject: [PATCH] CircleCI configuration tweaks (#1868) * remove attach_workspace * leave default working_directory * use npm ci for installing deps * rename dependencies job --- .circleci/config.yml | 66 ++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e4c18399d..9a97c1e48 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,75 +3,57 @@ version: 2 # unless with workaround. For simplicity just use it. # https://github.com/CircleCI-Public/circleci-cli/issues/79 -jobs: - build: +aliases: + - &defaults docker: - image: circleci/node:8 - working_directory: ~/project + + - &cache_key_node_modules + key: v1-node_modules-{{ checksum "package-lock.json" }} + +jobs: + dependencies: + <<: *defaults steps: - checkout - - attach_workspace: - at: ~/project - # Download and cache dependencies - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + <<: *cache_key_node_modules - run: name: Install npm dependencies - command: npm install - + command: | + if [ ! -d node_modules ]; then + npm ci + fi - save_cache: paths: - node_modules - key: v1-dependencies-{{ checksum "package-lock.json" }} + <<: *cache_key_node_modules lint: - docker: - - image: circleci/node:8 - working_directory: ~/project + <<: *defaults steps: - checkout - - attach_workspace: - at: ~/project - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + <<: *cache_key_node_modules - run: name: Linter command: npm run lint test: - docker: - - image: circleci/node:8 - working_directory: ~/project + <<: *defaults steps: - checkout - - attach_workspace: - at: ~/project - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + <<: *cache_key_node_modules - run: name: Unit tests command: npm run test coverage: docker: - image: circleci/node:8 - working_directory: ~/project steps: - checkout - - attach_workspace: - at: ~/project - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + <<: *cache_key_node_modules - run: name: Unit tests with coverage report command: npm run test @@ -84,13 +66,13 @@ workflows: version: 2 everything: jobs: - - build + - dependencies - lint: requires: - - build + - dependencies - test: requires: - - build + - dependencies - coverage: requires: - - build + - dependencies