.circleci/config.yml
version: 2
aliases:
- &defaults
docker:
- image: circleci/ruby:2.5.3-node-browsers
working_directory: ~/grease
environment:
CC_TEST_REPORTER_ID: $REPORTER_ID
- &restore_cache
restore_cache:
keys:
- v1-bundle-{{ .Branch }}-{{ .Revision }}-{{ checksum "Gemfile" }}
- v1-bundle-{{ .Branch }}-{{ .Revision }}-
- &save_cache
save_cache:
paths:
- ./vendor/bundle
key: v1-bundle-{{ .Branch }}-{{ .Revision }}-{{ checksum "Gemfile" }}
jobs:
install_deps:
<<: *defaults
steps:
- checkout
- run:
name: Installing Dependencies...
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- *save_cache
build:
<<: *defaults
steps:
- checkout
- *restore_cache
- 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
backend_tests:
<<: *defaults
steps:
- checkout
- *restore_cache
- run:
name: Installing Dependencies...
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- *save_cache
- attach_workspace:
at: ~/grease/tmp
- run:
name: Running Backend Tests
command: |
bundle exec rake
./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.backend.json coverage/.resultset.json
- persist_to_workspace:
root: tmp
paths:
- codeclimate.backend.json
upload_coverage:
<<: *defaults
steps:
- attach_workspace:
at: ~/grease/tmp
- run:
name: Uploading Coverage...
command: |
./tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -p 2 -o tmp/codeclimate.total.json
./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json
workflows:
version: 2
build:
jobs:
- install_deps
- build:
requires:
- install_deps
- backend_tests:
requires:
- build
- upload_coverage:
requires:
- backend_tests