Circle Ci and CodeClimate test coverage (Ruby)

coverage
ruby

#1

Hello and thank you in advance for your help. I am trying to get Circle CI to send my test coverage results to CodeClimate. The results are being saved into Artifacts but they don’t seem to be getting sent to CodeClimate. CodeClimate says it can only take coverage results from the default branch of my repo, which is master. Maybe this has something to do with it?

Here is the part of my spec_helper.rb with test reporting info:

require 'simplecov'
# save to CircleCI's artifacts directory if we're on CircleCI
if ENV['CIRCLE_ARTIFACTS']
  dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
  SimpleCov.coverage_dir(dir)
end
SimpleCov.start

I put my CODECLIMATE_REPO_TOKEN into the environment vars in Circle CI
I also tried creating a circle.yml with the following:

test:
  post:
    - bundle exec codeclimate-test-reporter

But this caused the build to fail.

Here is a link to the successful build:
https://circleci.com/gh/alookatommorow/children-of-mex/43


#2

It looks like https://circleci.com/gh/alookatommorow/children-of-mex/51 went though and uploaded, however, since it wasn’t the master branch it didn’t show.

It looks like you got it working though :slight_smile: https://codeclimate.com/github/alookatommorow/children-of-mex/builds


#3

I’m struggling to get the results to send to codeclimate. Did you end up having to use

test:
  post:
    - bundle exec codeclimate-test-reporter

for it to work? I see the coverage artifacts after the build, and the debugging says upload success. When i try adding the codeclimate-test-reporter command to the post test the build fails.


#4