.circleci/config.yml
---
version: 2.1
orbs:
node: circleci/node@5
jobs:
build:
working_directory: ~/iiif-processor
docker:
- image: cimg/base:stable
steps:
- checkout
- node/install
- run:
name: Check for 'master' branch
command: |
git fetch --all --quiet --prune
if [[ -n "$(git branch --all --list master */master)" ]]; then
echo "A branch named 'master' was found. Please remove it."
echo "$(git branch --all --list master */master)"
fi
[[ -z "$(git branch --all --list master */master)" ]]
- restore_cache:
keys:
- node-modules-v1-{{ checksum "package.json" }}-{{ .Branch }}
- node-modules-v1-{{ checksum "package.json" }}-
- node-modules-v1-
- run:
name: Download cc-test-reporter
command: |
curl -L -o ./cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x ./cc-test-reporter
- run:
name: Install JS Dependencies
command: npm install
- save_cache:
key: node-modules-v1-{{ checksum "package.json" }}-{{ .Branch }}
paths:
- ~/iiif-processor/node_modules
- run:
name: JS Tests
command: |
./cc-test-reporter before-build
npm run-script test -- --coverage
mv coverage/clover.xml ./clover.xml
./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
- run:
name: Send coverage to Coveralls
command: npx coveralls < coverage/lcov.info