.circleci/config.yml
version: 2
defaults: &defaults
docker:
- image: cimg/node:16.15
working_directory: ~/link-redux
jobs:
build:
<<: *defaults
steps:
- run:
name: Download cc-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
- persist_to_workspace:
root: tmp
paths:
- cc-test-reporter
build-node-lts:
<<: *defaults
docker:
- image: cimg/node:lts
steps:
- checkout
- attach_workspace:
at: ~/link-redux/tmp
- restore_cache:
keys:
- v1-dependencies-lts
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-lts
- run: yarn lint
- run: yarn test
- run: ./tmp/cc-test-reporter format-coverage -t lcov -o ~/link-redux/tmp/codeclimate.node-lts.json coverage/lcov.info
- run: yarn build
- persist_to_workspace:
root: tmp
paths:
- codeclimate.node-lts.json
build-node-18:
<<: *defaults
docker:
- image: cimg/node:18.1
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-18
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-18
- run: yarn lint
- run: yarn test
- run: yarn build
build-node-16:
<<: *defaults
docker:
- image: cimg/node:16.15
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-16
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-16
- run: yarn lint
- run: yarn test
- run: yarn build
build-node-14:
<<: *defaults
docker:
- image: cimg/node:14.19
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-14
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-14
- run: yarn lint
- run: yarn test
- run: yarn build
upload-coverage:
<<: *defaults
environment:
CC_TEST_REPORTER_ID: 47706628039d77eb40bc53039ad623c6250d0630bfe723cf3956c5d37d8fd0ff
steps:
- attach_workspace:
at: ~/link-redux/tmp
- run:
name: Upload coverage results to Code Climate
command: |
~/link-redux/tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -p 1 -o tmp/codeclimate.total.json
~/link-redux/tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json
workflows:
version: 2
commit:
jobs:
- build
- build-node-lts:
requires:
- build
- build-node-18
- build-node-16
- build-node-14
- upload-coverage:
requires:
- build-node-lts