Travis-ci ruby ​​build with node 5

I tried a lot of things, but ended up unable to build gulp-pipeline-rails . script is executed locally, no problem.

The last problem I narrowed down is that I have a ruby language project that uses node, but I need node 5 . I found one snippet :

 #------------------------------ # Update the node version env: - TRAVIS_NODE_VERSION="5" install: - pwd - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION - npm install 

Although this seems to be updating node, it does something for my ruby ​​env, where rspec does not execute :

 $ pwd && bundle exec rake /home/travis/build/alienfast/gulp-pipeline-rails Could not find gem 'rspec' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems. 

Question With all that said, how easy is it to use node 5 with this .travis.yml ?

 language: ruby rvm: - 2.2.2 - ruby-head matrix: allow_failures: - rvm: ruby-head cache: bundler #------------------------------ # Setup before_script: - node -v # update npm - npm install npm -g # install Gulp 4 CLI tools globally from 4.0 GitHub branch - npm install https://github.com/gulpjs/gulp-cli/tarball/4.0 -g #------------------------------ # Build script: bundle exec rake 
+6
source share
3 answers

Try using the before_install step to add a second language to Travis, perhaps something like:

 before_install: - nvm install node 

nvm should be installed by default in the image of the Travis assembly (depending on which one you are using), and this command will install the latest version of Node.

After that, there can only be npm install -g gulp-cli@4.0 as the first step in your before_script stage (i.e. don't worry about updating npm), hopefully this should mean that the package still works fine and installs all your gems .

+6
source

I found this article that helped me a bit.

Relevant information from the article:

You can use nvm to control node versions in travis, however you must enable it first:

  install: - . $HOME/.nvm/nvm.sh - nvm install stable - nvm use stable 
+2
source

If the project language is ruby, Travis CI will run bundle install --jobs=3 --retry=3 by default.

If you define the install phase yourself in .travis.yml , by default it will not be executed in favor of the newly defined commands. the thinking here is to use reasonable magic by default, which should be easily redefined.

There are two solutions to this problem:

  • Add bundle install --jobs=3 --retry=3 to the install step
  • Rename the title of the node replacement snippet to before_install , as suggested by @ocean.
0
source

All Articles