Nothing happens after following the instructions in the README
ndbroadbent opened this issue · 2 comments
I'm using GitLab CI. I set the CODECOV_TOKEN
env variable, and I have these lines in my spec_helper.rb
:
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
After my tests finish running, I don't see any reports getting uploaded to Codecov.
I was under the impression that this Ruby library would replace the Bash uploader step, so I haven't used this line anywhere: I ran the tests locally without bash <(curl -s https://codecov.io/bash)
Do I also need the bash uploader when I'm using codecov-ruby?CODECOV_TOKEN
, and saw this error:
{"meta": {"status": 400}, "error": {"reason": "Please provide the repository token to upload reports via `-t :repository-token`", "context": null}}
So I'm trying to figure out why this isn't working for my CI builds. I am 100% sure that CODECOV_TOKEN
is being set properly, and also that this code is being called:
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
I also can't see any log output in my tests. Is there a way to increase the logging level so I can spot any problems?
More information:
I'm using rspec_booster
from test-boosters to split up my tests across 5 jobs. I run this command to start the tests:
$ TEST_BOOSTERS_RSPEC_TEST_EXCLUDE_PATTERN="spec/api/**"
TB_RSPEC_OPTIONS='--format RspecJunitFormatter --out rspec.xml'
rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL
This ends up running the following rspec
command:
bundle exec rspec --format RspecJunitFormatter --out rspec.xml
--format documentation --require /builds/docspring/docspring/vendor/bundle/ruby/2.6.0/bundler/gems/test-boosters-2d7f7e615904/rspec_formatters/semaphore_rspec3_json_formatter.rb
--format SemaphoreFormatter
--out /root/rspec_report.json <test files>
Will this cause problems with the SimpleCov.formatter?
Ahhhh, yes it looks like my custom rspec command is causing problems.
When I run:
rspec <test_file>
I see the "Please provide the repository token" error for CodeCov.
But when I run:
bundle exec rspec --format RspecJunitFormatter --out rspec.xml --format documentation --require /builds/docspring/docspring/vendor/bundle/ruby/2.6.0/bundler/gems/test-boosters-2d7f7e615904/rspec_formatters/semaphore_rspec3_json_formatter.rb --format SemaphoreFormatter --out /tmp/rspec_report.json <test file>
I get no log output related to CodeCov.
UPDATE: Ohhh strange, I narrowed it down to the presence of bundle exec
.
rspec <test_file>
works, but bundle exec rspec <test_file>
doesn't work.
AHH, sorry this was my fault! I'm doing some tricky things with SimpleCov and Spring, and this broke the CodeCov integration on CI. I managed to figure out a fix for this.
Sorry to bother you!