Trying to run
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
in before_install
, I end up with
/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 python3; fi" failed and exited with 1 during .
Your build has been stopped.
/Users/travis/.travis/job_stages: line 166: shell_session_update: command not found
So I assume the issue here is that ruby
is on version 2.0, which I confirmed with ruby --version
. The funny thing is, my builds just stopped working all of the sudden, without any change to .travis.yml.
So how do I actually change Ruby versions?
Might be important to not, that before git clone
is run I get this:
$ rvm use
Warning! PATH is not properly set up, '/Users/travis/.rvm/gems/ruby-2.0.0-p648/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p648'.
Your choices seem to be to either use
brew update
brew install whatever
or
HOMEBREW_NO_AUTO_UPDATE=1 brew install whatever
The advice in travis documentation to not do a brew update
if it doesn't seem to be needed seems to leave you at risk of random breakage when brew's ruby requirement is changed...
running brew update
before brew install package_name
For .NET Core projects: you can avoid using brew by not using Travis' default .NET Core but installing it using the Microsoft's .NET core sh script. I used to have mono
and dotnet
version definitions set which I've found were not needed after switching to the sh script. I was able to fix the Homebrew must be run under Ruby 2.3!
error by removing those two definitions (although I then had to update libunwind8
on Linux before doing the .NET core install).
Here's the complete .travis.yaml for running .NET core project test on osx and linux.
language: csharp
before_install:
- if [ "$OS" = "linux" ]; then sudo apt-get install libunwind8; fi
script:
- wget https://dot.net/v1/dotnet-install.sh && chmod +x dotnet-install.sh
- ./dotnet-install.sh --version 1.1.4 --install-dir $HOME/.dotnet
- $HOME/.dotnet/dotnet restore
- $HOME/.dotnet/dotnet test YOUR_CSPROJ_FILE_PATH
matrix:
include:
- os: linux
dist: trusty
env: OS=linux
- os: osx
osx_image: xcode9
env: OS=osx
branches:
only:
- master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With