Skip to content

Supported Languages

Sam Gleske edited this page Oct 4, 2017 · 12 revisions

The supported languages for generating lifecycles is dictated by Jenkins administrators in the lifecycles.json file. Here's the sample lifecycles.json for the master branch. Initial wishlist of supported languages is groovy, java, ruby, and python. Here is a list of languages supported by Travis CI.

Groovy

The most basic .jervis.yml file for a Groovy project will have the following contents.

language: groovy

If you need to override one of the steps then you can do so in the following manner.

language: groovy
install: true
script: ./build.sh

By using true to override a step it will effectively skip that step by executing /bin/true. Jervis will then detect the following build tools in order.

Gradle wrapper

If your project has a gradlew file in the root of the repository then Jervis will run the following install command to install dependencies.

install: ./gradlew assemble

Jervis will execute the following script command to run unit tests.

script: ./gradlew check

If Jervis doesn't have a gradlew file then it will fall back to checking for Gradle.

Gradle

If your project has a build.gradle file in the root of the repository then Jervis will run the following install command to install dependencies.

install: gradle assemble

Jervis will execute the following script command to run unit tests.

script: gradle check

If Jervis doesn't have a build.gradle file then it will fall back to checking for Maven.

Maven

If your project has a pom.xml file in the root of the repository then Jervis will run the following install command to install dependencies.

install: mvn install -DskipTests=true

Jervis will execute the following script command to run unit tests.

script: mvn test

If Jervis doesn't have a pom.xml file then it will fall back to generating a script for Ant.

Ant

Ant has no standard way of installing dependencies. Therefore, there is no default install command defined. However, you can define one yourself. For example,

install: ant deps

Jervis will execute the following script command to run unit tests.

script: ant test

Build matrix

See Groovy build matrix support.

Java

The most basic .jervis.yml file for a Java project will have the following contents.

language: java

If you need to override one of the steps then you can do so in the following manner.

language: java
install: true
script: ./build.sh

By using true to override a step it will effectively skip that step by executing /bin/true. Jervis will then detect the following build tools in order.

Gradle wrapper

If your project has a gradlew file in the root of the repository then Jervis will run the following install command to install dependencies.

install: ./gradlew assemble

Jervis will execute the following script command to run unit tests.

script: ./gradlew check

If Jervis doesn't have a gradlew file then it will fall back to checking for Gradle.

Gradle

If your project has a build.gradle file in the root of the repository then Jervis will run the following install command to install dependencies.

install: gradle assemble

Jervis will execute the following script command to run unit tests.

script: gradle check

If Jervis doesn't have a build.gradle file then it will fall back to checking for Maven.

Maven

If your project has a pom.xml file in the root of the repository then Jervis will run the following install command to install dependencies.

install: mvn install -DskipTests=true

Jervis will execute the following script command to run unit tests.

script: mvn test

If Jervis doesn't have a pom.xml file then it will fall back to generating a script for Ant.

Ant

Ant has no standard way of installing dependencies. Therefore, there is no default install command defined. However, you can define one yourself. For example,

install: ant deps

Jervis will execute the following script command to run unit tests.

script: ant test

Build matrix

See Java build matrix support.

Python

Python does not have a standard way for building so the install and script key should be specified in the YAML file.

language: python
install: pip install -r requirements.txt
script: python setup.py test

The following toolchains can be customized for Python.

python

language: python
python: 2.7

Jervis uses virtualenv to isolate python environments. The default python used is: python: 2.7. virtualenv is activated before the python build starts. If virtualenv is not desirable or a different virtualenv is desired then the before_install step can be used to deactivate virtualenv.

before_install: deactivate

Then proceed to activate your own virtualenv. There are multiple pythons available for use. Current supported versions of python in the example toolchains.json are:

  • 2.6
  • 2.7
  • 3.2
  • 3.3
  • 3.4
  • pypy
  • pypy3

For example, if you wanted to use the latest Python 3.4, then the following YAML will accomplish that.

python: 3.4

Build matrix

See Python build matrix support.

Ruby

The most basic .jervis.yml file for a Ruby project will have the following contents.

language: ruby

By default ruby will execute the following install and script.

install: bundle install --jobs=3 --retry=3
script: bundle exec rake

If a Gemfile.lock file exists in the root of the repository then --deployment option is added to the install command.

The following toolchains are setup and are customizable for building ruby projects.

gemfile

By default, the gemfile is Gemfile.

gemfile sets up the environment by exporting the environment variable BUNDLE_GEMFILE. Here's an example for non-standard path Gemfile.

gemfile: custom/Gemfile

rvm

By default, Ruby rvm loads Ruby 1.9.3. This can be customized.

rvm: 2.4.2

jdk

By default, ruby loads OpenJDK 8. This can be customized.

jdk: openjdk9

Build matrix

See Ruby build matrix support.

Shell

Is a basic and empty language type defined to run scripts in the default shell of any selected platform and operating system. Shell does not have a standard way for building so the install and script key should be specified in the YAML file.

language: shell
script: echo "Hello World."

Build matrix

See Shell build matrix support.