I have been working on a project for the last couple of days and I decided it was about time I set up some kind of Continuous Integration tool to my repo in GitHub. I will describe here how you can achieve that in a few minutes with Travis CI.
First of all, what is Continuous Integration?
Continuous integration is a DevOps software development practice where developers regularly merge their code changes into a central repository, after which automated builds and tests are run. Continuous integration most often refers to the build or integration stage of the software release process and entails both an automation component (e.g. a CI or build service) and a cultural component (e.g. learning to integrate frequently). The key goals of continuous integration are to find and address bugs quicker, improve software quality, and reduce the time it takes to validate and release new software updates.
AWS
It turns out there are a lot of CI tools that integrate with GitHub, you can find a non-exhaustive list here. I was looking for a free solution and found this list here maintained by the GitHub community. I spotted Travis in the list. I am not familiar with Travis at all (I have used Jenkins and TeamCity in the past) but I have seen it being used quite a lot on GitHub so I thought I would give it a try.
Setting up Travis
Setting up Travis for my application took me literally 5 minutes, it was incredibly quick. All I had to do was to follow the guide here which I can summarise in my case by:
- Log in to Travis using my GitHub account.
- Activate Travis-CI for my repository.
- Add .travis.yml file to my repository.
Done!
I now have a CI tool set up for my project and can monitor the status on the Build Status page (as well as being notified automatically by email) so cool!
Worth knowing about Travis
Build lifecycle
I found this documentation page about Travis build lifecycle. I think it is worth reading to get an idea of what happened at build time.
Build Status icon
You can add the status of your build to any markdown file as described here. This is the current status of my project hopefully it is green ^^
Linter for .travis.yml
Travis has developed an online linter very useful if you have syntax errors and can’t spot them (mind the extra space…).
Build Matrix
I haven’t used the matrix feature yet but I think it is worth mentioning as it seems quite powerful. In my case I may use it later to build the client and server sides of the same application that live in the same repository. One solution is described in this article.