Tomas Garba4 min

Continuous integration with Travis

EngineeringCommunityApr 26, 2016

EngineeringCommunity

/

Apr 26, 2016

Tomas GarbaAndroid Engineer

Share this article

At STRV we want to get client feedback as soon as possible, so we regularly send them the working prototype of their app. This means on a weekly if not daily basis clients get to see the status of their app as it is being developed. This helps us respond very quickly and integrate new ideas into the app. To achieve this goal we use a technique called Extreme programming, and continuous integration with Travis is part of this technique.

Travis CI helps us create automated builds when someone from the development team commits to the master branch, other branches or even creates a pull request. It also helps detect potential integration bugs.

Pull requests

Every pull request will also trigger an automated build, which is really helpful when we are developing new features. If the build status is failing, the owner of the repository and the developer who created the pull request are both notified and will be able to fix this problem immediately.

Why Travis

There are many other CI tools you can use, including Jenkins, Circle CI, Wercker, Drone.io, Gitlab-CI, Codeship, Shippable and Semaphore. We use Travis, because it is easy to set up a new project, and it is automatically connected with our Github. We also don’t have to manage the infrastructure like we would if we used, for example, Jenkins.

Travis currently supports many languages:

C, C++, C#, Java, JavaScript (with Node.js), Objective-C and Swift, PHP, Python and many more.

You can configure Travis with a “.travis.yml” file, which is very helpful. You can also set up a configuration for every branch and run different types of unit tests, UI tests, etc.

Here’s what STRV engineers have to say about the benefits of Travis:

Android department experience (Java)

Jakub Kinst: “As we wanted to speed up the app deployment process, we figured out that we could utilize the Google Play Store API to automatically upload and release a build. With the help of a Gradle plugin wrapping, the Play Store API and a couple of tweaks, we now have Travis CI preparing and uploading the APK file automatically to our clients. Of course, this is only after all unit and integration tests pass.”

iOS department experience (Objective-C & Swift)

Vojta Stavik: “While setting up Travis to do basic continuous testing was a straightforward process, we spent several days trying to make it work for an AppStore deployment. The fact that it took us such a long time wasn’t Travis’ fault. It was mainly caused by Apple and the changes it made in Xcode and iTunesConnect over the past several months. There’s a lot of information about Xcode and Travis integration available on the Internet, however most of it is not up-to-date.

Once you pass this initial barrier, Travis is a great tool to work with. The fact that you can easily combine it with other tools like xcpretty or Fastlane, makes it super powerful. After several months of using Travis (and hours of my time saved), I can no longer imagine doing AppStore builds manually.”

Backend department experience (NodeJS)

Robert Rossmann: “For NodeJs 4.0 and up, we had to install a new C++ compiler in order to run native modules, because Travis uses an old Ubuntu server version (12.04) which doesn’t support new C++ language features used by Node and V8 JavaScript Engine.

Alternatively, you can try out a new beta build environment based on Ubuntu 14.04, which already contains the required C++ compiler.

In general we are very satisfied with Travis and use it for automatic deployments to Heroku on a daily basis.”

Comparing Travis with Jenkins

If you want to host all your code in-house you can use Jenkins, which is an open source continuous integration tool written in Java. It’s not so easy to set up Jenkins, but you will have full control over your source code, and you can create Jenkins jobs to cover your specific needs.

Jenkins is free to use, but you will have to set up your own server and maintain this infrastructure. Deciding whether or not to use Jenkins depends on your project type. It can take hours or days to set up the server, but there is a lot of documentation available online to help you do this.

The great thing about Jenkins is that you have full control over your CI. Once Jenkins is configured, you can do almost anything (e.g: run tests on multiple nodes, connect your server with popular communication services, generate test reports and statistics, create custom complex sequences of tasks). Over the past several years the Jenkins community created hundreds of plugins that added new functions, services, etc. to Jenkins. You can use these additions in order to craft your continuous integration flow to your specific needs.

Travis is free for open source public project, and everyone can see your source code. If you want to host a private project, costs start at $129 per month. This is reasonable if you have many projects. Travis will charge you per service not per project.

As you can see Travis CI is really helpful for us, allowing us to focus on client needs and be more confident that we are delivering a quality app to the client.

Share this article