Home CodeClimate and Travis configuration ignoring commands
Reply: 1

CodeClimate and Travis configuration ignoring commands

Guilherme Pereira
1#
Guilherme Pereira Published in 2018-02-13 20:19:06Z

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?

Guilherme Pereira
2#
Guilherme Pereira Reply to 2018-02-13 23:49:05Z

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>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.324283 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO