.circleci/config.yml
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
# - image: circleci/node:8.15-browsers
- image: circleci/node:10.15.0-browsers
- image: mongo:3.4.20-jessie
working_directory: ~/repo
steps:
# Checkout the code from the branch into the working_directory
- checkout
# Setup Code Climate test-reporter
- run:
name: Setup Code Climate test-reporter
command: |
# download test reporter as a static binary
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
# Log the current branch
- run:
name: Show the current branch
command: echo ${CIRCLE_BRANCH}
# Restore local dependencies from cache
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
# Download yarn
- run:
name: Install yarn
command: npm install yarn
# Download local dependencies
- run:
name: Install local dependencies
command: yarn install
# Cache local dependencies if they don't exist
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# Lint the source code
# - run:
# name: Linting
# command: yarn lint
# run tests!
- run:
name: Testing
command: |
# notify Code Climate of a pending test report using `before-build`
./cc-test-reporter before-build
# run tests with coverage
yarn test-coverage
# upload coverage to code climate using `after-build`
./cc-test-reporter format-coverage -t lcov ./coverage/lcov.info
./cc-test-reporter upload-coverage