I'm trying to setup Travis and CodeClimate integration but after setting test coverage configuration, my build started to fail.
My .travis.yml
file contains something like
language: ruby
rvm:
- 2.5.0
branches:
only:
- master
services:
- postgresql
env:
- RAILS_ENV=test
global:
- DB=postgresql
- CC_TEST_REPORTER_ID=<my_cc_id>
bundler_args: --without production
script:
- bundle exec rake db:schema:load
- bundle exec rake db:test:prepare
- bundle exec rake spec
before_script:
- cp config/database.travis.yml config/database.yml
- psql -c 'create database my_db_test;' -U postgres
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./test_reporter
- chmod +x ./test_reporter
- ./test_reporter before-build RAILS_ENV=test
after_script:
- ./test_reporter after-build --exit-code $TRAVIS_TEST_RESULT
Before the test coverage integration, the output displayed these lines, just after bundle install
$ psql -c 'create database my_db_test;' -U postgres
$ cp config/database.travis.yml config/database.yml
but after, the output displays this line after bundle install
$ bundle exec rake
/home/travis/.rvm/rubies/ruby-2.5.0/bin/ruby -I/home/travis/build/username/repo/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.7.1/lib:/home/travis/build/username/repo/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.7.1/lib /home/travis/build/username/repo/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.7.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
the bundle exec rake
runs before my command to overwrite database.yml
and breaks the build.
Can someone help me understand what is this command and why is he beeing called?
I've solved this issue, the failures was being caused by my var configuration. The right way to config them is:
env:
global:
- RAILS_ENV=test
- DB=postgresql
- CC_TEST_REPORTER_ID=<my_cc_id>