My project uses both nodejs and java
I tried starting off with a node_js build then installing java (since this is an npm module)
but the scripts to install java failed, plus I don't think there's a need to install it when there is a build with java that already exists.
should I start off with a java build then install node?
I'm trying this
language: java - oraclejdk8 language: node_js node_js: - "0.10"
which ignores the first 2 lines it seems and builds a node_js build which has java 7 and my project uses java 8
I tried this answer for python
using
language: node_js node_js: - "0.10" java: oraclejdk8
but that didn't work
How can I add java 8?
3) To set up a build environment and prepare the build, Travis CI's system fetches and processes the . travis. yml config file from the repository and the branch explicitly specified in the build request, triggered by GitHub.
Like Jenkins, Travis CI is also one of the early players in the CI/CD tools market. The tool is written in Ruby and is developed & maintained by the Travis CI community. Travis CI was earlier available only for GitHub hosted projects but now it also supports Bitbucket hosted projects.
Trigger Travis CI builds using the API V3 by sending a POST request to /repo/{slug|id}/requests : Get an API token from your Travis CI settings page. You'll need the token to authenticate most of these API requests.
It seems to be possible now to run several languages in one .travis.yml file using the jobs:include
feature. As an example, my Github repo is arranged as follows:
project/ - top-level github directory project/backend - Python backend project/backend/tests - Python tests project/android/AppName - Android app project/ios/AppName - iOS app
Here is the .travis.yml, which runs tests in Python, Java, and Objective-C:
jobs: include: - language: python python: 2.7 before_script: - cd backend/tests script: - python -m unittest discover - language: android dist: trusty jdk: oraclejdk8 android: components: - tools - android-25 - build-tools-25.0.3 before_script: - cd android/AppName script: - ./gradlew build connectedCheck - language: objective-c os: osx osx_image: xcode8.3 before_script: - cd ios/AppName script: - xcodebuild -workspace AppName.xcworkspace -scheme AppName -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3' build test notifications: email: - [email protected]
It seems you can build as many different configurations as you like using this feature, by treating each entry in the matrix as a top level config. Of course, if you have any parameters you want to set that apply to all languages, you can do that at the top level, as I do here with the notifications:email
section.
When it is all set up, then on each build, you get something like this. Boom.
On a Travis Java build environment, you can use nvm
to manage Node.js runtimes:
.travis.yml
language: java jdk: - oraclejdk8 env: - NODE_VERSION="0.12" before_install: - nvm install $NODE_VERSION
If your Node version is very recent, you might have to update nvm
too.
To update nvm
, write this in your .travis.yml
:
before_install: - wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh - source ~/.nvm/nvm.sh - nvm install 5 # for Node v5 - node --version
The above example shows how to first update to nvm v0.31
, to then obtain Node v5
.
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