Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI Ruby Version conflict

I'm currently trying to use TravisCI properly for my rails app but I'm a bit stuck with the problem I'm facing.

In my .travis.yml

I've got this :

language: ruby
before_install:
  - gem install bundler
rvm:
  - 2.0.0
env:
  - DB=sqlite
  - DB=mysql
  - DB=postgresql
script:
  - rake db:migrate
  - rake db:test:prepare

And in my Gemfile I precise Ruby version : ruby "2.0.0"

With this .travis.yml the tests fails saying to me :

$ gem --version

2.0.3

$ bundle install --deployment

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0

But when I modify my .travis.yml like this :

language: ruby
before_install:
  - gem install bundler
rvm:
  - 1.9.3
  - 2.0.0
env:
  - DB=sqlite
  - DB=mysql
  - DB=postgresql
script:
  - rake db:migrate
  - rake db:test:prepare

Travis CI runs the test twice (once for 1.9.3 version and once for 2.0.0 version) and fails with 1.9.3 version and succeed with 2.0.0 version.

What am I doing wrong in order to just pass the test with 2.0.0 ruby version ?

Cordially rob

like image 225
user2462805 Avatar asked Mar 25 '26 19:03

user2462805


1 Answers

I found what was wrong, TravisCI was looking for a .travis.yml in each branch but I only had one in my master branch (I thought TravisCI was only checking master branch). I added a .travis.yml and all was ok.

like image 126
user2462805 Avatar answered Mar 28 '26 09:03

user2462805