275

For my project I need to choose between Jenkins and Travis-CI. I’ve been using Jenkins for years but I’ve also read good reviews about Travis-CI.

Which one would you use for an Open Source project? What are the main benefits or advantages of both?

cmbuckley
  • 33,879
  • 7
  • 69
  • 86
Juan Luis
  • 3,197
  • 4
  • 14
  • 16

3 Answers3

296

Travis-ci and Jenkins, while both are tools for continuous integration are very different.

Travis is a hosted service (free for open source) while you have to host, install and configure Jenkins.

Travis does not have jobs as in Jenkins. The commands to run to test the code are taken from a file named .travis.yml which sits along your project code. This makes it easy to have different test code per branch since each branch can have its own version of the .travis.yml file.

You can have a similar feature with Jenkins if you use one of the following plugins:

  • Travis YML Plugin - warning: does not seem to be popular, probably not feature complete in comparison to the real Travis.
  • Jervis - a modification of Jenkins to make it read create jobs from a .jervis.yml file found at the root of project code. If .jervis.yml does not exist, it will fall back to using .travis.yml file instead.

There are other hosted services you might also consider for continuous integration (non exhaustive list):


How to choose ?

You might want to stay with Jenkins because you are familiar with it or don't want to depend on 3rd party for your continuous integration system. Else I would drop Jenkins and go with one of the free hosted CI services as they save you a lot of trouble (host, install, configure, prepare jobs)

Depending on where your code repository is hosted I would make the following choices:

  • in-house → Jenkins or gitlab-ci
  • Github.com → Travis-CI

To setup Travis-CI on a github project, all you have to do is:

  • add a .travis.yml file at the root of your project
  • create an account at travis-ci.com and activate your project

The features you get are:

  • Travis will run your tests for every push made on your repo
  • Travis will run your tests on every pull request contributors will make
Community
  • 1
  • 1
Thomasleveil
  • 69,168
  • 10
  • 106
  • 102
  • 26
    In my experience, using Jenkins over Travis will also save you a lot of trouble (`.travis.yml`!) I have several github projects that I am running my own Jenkins for, and I don't regret that one bit. If you have the ability to run your own Jenkins, I'd highly encourage that option. It's nice to have 100% control of your CI-environment. – Simon Forsberg Jul 06 '16 at 19:24
  • 23
    The Jenkins Pipeline plugin (which is meant to replace free-style projects in most situations) allows for the pipeline groovy script to be placed in a file (typically named "Jenkinsfile") in your project, allowing it the same features that are mentioned in Travis-CI above, with that added bonus of being supported by the Jenkins team. – KhainTCore Apr 25 '17 at 21:57
49

I worked on both Travis and Jenkins: I will list down some of the features of both:

Setup CI for a project

Travis comes in first place. It's very easy to setup. Takes less than a minute to setup with GitHub.

  1. Login to GitHub
  2. Create Web Hook for Travis.
  3. Return to Travis, and login with your GitHub credentials
  4. Sync your GitHub repo and enable Push and Pull requests.

Jenkins:

  1. Create an Environment (Master Jenkins)
  2. Create web hooks
  3. Configure each job (takes time compare to Travis)

Re-running builds

Travis: Anyone with write access on GitHub can re-run the build by clicking on `restart build

Jenkins: Re-run builds based on a phrase. You provide phrase text in PR/commit description, like reverify jenkins.

Controlling environment

Travis: Travis provides hosted environment. It installs required software for every build. It’s a time-consuming process.

Jenkins: One-time setup. Installs all required software on a node/slave machine, and then builds/tests on a pre-installed environment.

Build Logs:

Travis: Supports build logs to place in Amazon S3.

Jenkins: Easy to setup with build artifacts plugin.

rameshthoomu
  • 1,200
  • 1
  • 11
  • 31
  • Could you please tell , What is S3? – Pooja Sep 27 '16 at 13:46
  • @Pooja [Amazon S3](https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjdhJzi5q_PAhWLhywKHXOxDK0QFgg7MAE&url=http%3A%2F%2Fdocs.aws.amazon.com%2FAmazonS3%2Flatest%2Fdev%2FWelcome.html&usg=AFQjCNFk4UW2rsrUz3oblpunH4emCgMr_Q&sig2=p5QqS4nVpazh4BMju5CG-A) – adrianN Sep 27 '16 at 14:54
31

I would suggest Travis for Open source project. It's just simple to configure and use.

Simple steps to setup:

  1. Should have GITHUB account and register in Travis CI website using your GITHUB account.
  2. Add .travis.yml file in root of your project. Add Travis as service in your repository settings page.

Now every time you commit into your repository Travis will build your project. You can follow simple steps to get started with Travis CI.

appsntech
  • 712
  • 1
  • 6
  • 19
  • 7
    A caveat for using Travis CI for Open Source: It runs its builds and tests on either Linux or OSX, not Windows. So if your project is, say, .NET or PowerShell it will need to be written in a cross-platform version of .NET (either Mono or .NET Core) or PowerShell (PowerShell Core) for you to be able to use Travis CI. A more Windows-friendly hosted CI tool is [Appveyor](https://www.appveyor.com).. – Simon Tewsi Mar 02 '18 at 22:27