Skip to content

Commit a25a4bb

Browse files
Try to upload test coverage to codeclimate
1 parent f9e8504 commit a25a4bb

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.circleci/config.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
command: |
3232
bundle install --jobs=4 --retry=3 --path vendor/bundle
3333
34+
- run:
35+
name: Install Code Climate Test Reporter
36+
command: |
37+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
38+
chmod +x ./cc-test-reporter
39+
3440
- save_cache:
3541
paths:
3642
- ./vendor/bundle
@@ -51,16 +57,53 @@ jobs:
5157
name: run tests
5258
command: |
5359
mkdir /tmp/test-results
60+
./cc-test-reporter before-build
5461
TEST_FILES="$(circleci tests glob "spec/usage/**/*_spec.rb" | circleci tests split --split-by=timings)"
5562
5663
bundle exec rspec --format progress \
5764
--out /tmp/test-results/rspec.xml \
5865
--format progress \
5966
$TEST_FILES
6067
68+
- run:
69+
name: Code Climate Test Coverage
70+
command: |
71+
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
72+
- persist_to_workspace:
73+
root: coverage
74+
paths:
75+
- codeclimate.*.json
76+
6177
# collect reports
6278
- store_test_results:
6379
path: /tmp/test-results
6480
- store_artifacts:
6581
path: /tmp/test-results
6682
destination: test-results
83+
84+
upload-coverage:
85+
docker:
86+
- image: circleci/ruby:2.5.1-stretch-node
87+
environment:
88+
CC_TEST_REPORTER_ID: 57123bd0e8b6c96bd254bf1fe46a5582250cd5e726ff639f85bfcd310f870f4a
89+
working_directory: ~/repo
90+
91+
steps:
92+
- run:
93+
name: Install Code Climate Test Reporter
94+
command: |
95+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
96+
chmod +x ./cc-test-reporter
97+
- run:
98+
command: |
99+
./cc-test-reporter sum-coverage --output - codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
100+
101+
workflows:
102+
version: 2
103+
104+
commit:
105+
jobs:
106+
- build
107+
- upload-coverage:
108+
requires:
109+
- build

0 commit comments

Comments
 (0)