.circleci/config.yml
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
defaults: &defaults
docker:
# specify the version you desire here
- image: circleci/node:dubnium-stretch
working_directory: ~/tmp/circlci-now
version: 2
jobs:
checkout:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/tmp/circlci-now
- restore_cache:
keys:
- npm-cache-{{ .Branch }}-{{ checksum "package.json" }}
- npm-cache-{{ .Branch }}
# fallback to using the latest cache if no exact match is found
- npm-cache-
- run:
name: 'Install dependencies'
command: |
yarn
yarn bootstrap
- run:
name: 'Build projects'
command: |
yarn build
# - run:
# name: Install Code Climate test-reporter
# command: |
# mkdir -p tmp/
# curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
# chmod +x ./tmp/cc-test-reporter
- save_cache:
key: npm-cache-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- .
lint:
<<: *defaults
steps:
- attach_workspace:
at: ~/tmp/circlci-now
- run:
name: 'Lint'
command: |
yarn lint
unit-tests:
<<: *defaults
steps:
- attach_workspace:
at: ~/tmp/circlci-now
- run:
name: 'Unit tests'
command: |
yarn test
# for f in packages/*; do
# if [ -d "$f" ]; then
# echo $f
# if [ -d "$f/coverage" ]; then
# ./tmp/cc-test-reporter format-coverage -t lcov -o tmp/coverage.${f//\//-}.json $f/coverage/lcov.info
# fi
# fi
# done;
# ./tmp/cc-test-reporter sum-coverage -o tmp/coverage.total.json tmp/coverage.*.json
# ./tmp/cc-test-reporter upload-coverage -i tmp/coverage.total.json -r $CC_TEST_REPORTER_ID
workflows:
version: 2
tests:
jobs:
- checkout
- lint:
requires:
- checkout
- unit-tests:
requires:
- checkout