Open Source Tools: Build – Travis & AppVeyor

Open Source projects have higher chances for success if their build instructions are clear and easily reproducible by anyone. It’s a very good idea to include a file that contains environment setup and clear build instructions to be followed. Even better would be to additionally configure a remote build mechanism that publicizes build status and results. This build mechanism can be used to

  • Build and publish released binaries.
  • Publish code coverage results and other quality gates.
  • Build branches on demand, validating external contributions before merging (based on pull requests from GitHub for example).

There are several options out there that can be used to fulfill these goals and others however I’d like to point out that Travis is perhaps the easiest remote build system that exists out there. The only thing you need to add to your repository sources is a .travis.yml file with the following line in it:

language: java

Next, log into Travis using your GitHub credentials, no need to create a new account, just grant access to Travis and voilá! Navigate to the left sidebar, locate the repository you want to activate, flick the switch and make a push to the repository. That should be enough to get your first build started.

What’s great about Travis is that it comes with sensible defaults and will understand most Maven and/or Gradle builds, it can even launch the build using the wrapper scripts for either of the two tools, neat! You can further customize build environment, steps, and the outcome to match your requirements. You can for example push code coverage reports to an external server, publish binaries to an artifact repository, publicize the build’s status to Twitter or some other medium, and more; review the documentation to see for yourself all you can do with this service. It’s dashboard is clean and to the point, it gives you quick access to all relevant information and the build log.

It’s worth noting that Travis uses Linux based environments to run a build, which for most projects should be an acceptable setup. However there may be times when you need to target another platform such as Windows. Unfortunately Travis can’t help but there’s another build service that you can choose: AppVeyor. You can login into this service using your GitHub account as well. Setting up AppVeyor requires adding a file named appveyor.yml whose syntax is very similar to Travis.

AppVeyor comes with its own build hooks and configuration, it would be a good idea to review its documentation to figure out what else can be done with this service.

Disclaimer: I’m in no way related to Travis, AppVeyor nor the companies behind them. I merely provide information on these services based on their free version.

Leave a Reply

Your email address will not be published. Required fields are marked *

ˆ Back To Top