Travis Homebrew Failure

travis

#1

Recently I get the following error on travis:

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)
The command "if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi" exited with 1.

I am not sure where to start fixing this and would be grateful for suggestions.

Here is my Travis file:

language: julia

os:
  - linux
  - osx

julia:
  - 0.5

addons:
  apt:
    packages:
    - gfortran

notifications:
  email: false

script:
  - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
  - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
  - julia -e 'ENV["PYTHON"]=""; Pkg.add("PyCall"); Pkg.add("Conda"); using Conda; Conda.add("NumPy"); Conda.add("SciPy"); Pkg.clone(pwd()); Pkg.build("JuLIP"); Pkg.test("JuLIP"; coverage=true)'

#2

I got that too


#3

It seems, this is the problem:
https://github.com/travis-ci/travis-ci/issues/8552


#4
before_install:
  - brew update

fixes the problem


#5

Hmmm, I have this in

  - if [ `uname` = "Linux" ]; then
      sudo apt-get install libgmt-dev;
    elif [ `uname` = "Darwin" ]; then
      brew update
      brew install homebrew/science/gmt;
    fi

but it now still errors

$ if [ `uname` = "Linux" ]; then sudo apt-get install libgmt-dev; elif [ `uname` = "Darwin" ]; then brew update brew install homebrew/science/gmt; fi

Error: This command updates brew itself, and does not take formula names.

Use 'brew upgrade <formula>'.

#6

Travis does not properly handle multi-line bash commands. You can either put everything in one line (with && or ; to separate commands) or just put all the steps into a shell script and call that script from .travis.yml.


#7

Yes, with the && (brew update && brew install ...) it worked. Thanks.