From 80973fab8448044c672ad52907c73b1b148b97d7 Mon Sep 17 00:00:00 2001 From: alxshelepenok Date: Sun, 11 Nov 2018 15:51:30 +0300 Subject: [PATCH] Update circleci config --- .circleci/config.yml | 85 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 568fd98..39b7d79 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,35 +1,82 @@ version: 2 +defaults: &defaults + docker: + - image: circleci/node:8.9.1 + working_directory: ~/gatsby-starter-lumen + jobs: - test: - working_directory: ~/gatsby-starter-lumen - docker: - - image: circleci/node:8.9.1 + install: + <<: *defaults steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "yarn.lock" }} - # fallback to using the latest cache if no exact match is found - - dependencies- - - run: - name: Install and build package - command: yarn install --frozen-lockfile - - run: - name: "Lint" - command: yarn lint:all - - run: - name: Coverage - command: yarn test:coverage --runInBand --no-cache - - run: - name: Unit tests - command: yarn test --runInBand --no-cache + - run: yarn install --frozen-lockfile - save_cache: paths: - node_modules key: dependencies-{{ checksum "yarn.lock" }} + + lint: + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "yarn.lock" }} + - run: yarn lint + + test: + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "yarn.lock" }} + - run: yarn test --runInBand --no-cache + + coverage: + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "yarn.lock" }} + - run: yarn test:coverage --runInBand --no-cache + - save_cache: + key: coverage-{{ .Environment.CIRCLE_SHA1 }} + paths: + - coverage + + codecov: + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "yarn.lock" }} + - restore_cache: + keys: + - coverage-output-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn global add codecov + - run: yarn codecov + workflows: version: 2 build_test: jobs: - - test \ No newline at end of file + - install + - lint: + requires: + - install + - test: + requires: + - install + - coverage: + requires: + - install + - codecov: + requires: + - coverage \ No newline at end of file