Continuous Integration for Open Source Projects
Posted Oct 8, 2014 | 3 min. (471 words)We support a large amount of platforms and languages at Raygun. The vast majority of these are maintained by us as open source projects on Github. We would love to provide the same rigorous continuous integration process that we use with our closed systems for our open source projects as well. Unfortunately as we can’t give everyone access to our build server, we had to come up with a different approach. Enter Travis CI, they provide online continuous integration and deployment. They also happen to provide free setup for open source projects.
Adding Travis CI to your project is simple. I’ll take you through the process I followed to set this up for the Node provider.
The first thing you will need to do is sign in to Travis CI, if you are setting up your open source repository then you can do that at https://travis-ci.org, but if you want to build your closed source projects then you will need to sign in here https://travis-ci.com. From there you will see a list of all your repositories. You can then flip any of them on inside of Travis CI which enable it to watch the repository and perform the builds.
The next thing you will need to do is to create a .travis.yml file in the root of your repository. This will allow you to set the language that your repository is using and other options so that Travis CI knows how to build and test your code. Here is an example for Node
language: node_js
node_js:
- "0.11"
- "0.10"
As you can see you can specify what versions of Node you would like the tests to run under, this is super handy for checking all of your supported versions. Travis CI will then use npm install and npm test to setup and run your tests. This can be configured as you like, here is a good blog post on using npm to do task automation.
Another really handy feature of Travis CI is setting up protected environment variables. If your tests require using sensitive information that you don’t want to check into your repository then you can configure this within Travis CI and your environment variables will be provided to the build and hidden from the results. Really good for things such as API keys and connection strings.
I recommend setting up Travis CI for your projects and giving it a spin yourself and you will see how easy it is to get set up. There is now no excuse for not having your tests run and the results being available to everyone on your open source projects!
Did you know Raygun saves you time and helps you build better software?
Try Raygun for free today and discover why so many developers across the world use Raygun with their apps.