What is Continuous Integration? A look at Travis-CI

Recently I was working on a project and it was working as expected. It was complete along with tests and then Shubham asked me to read more about Continuous Integration/Travis-CI and add it to the project. I had no clue what it was! This article is all about how I got it working and what are its benefits, etc.

What is CI?

According to Wiki:

In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.

Now, this might be a confusing definition if you’re not familiar with Version Control. If you know about it, then it’s just essentially collaborating on code continuously and making sure that everything works after each addition of code.

In simpler terms, consider this flow:

  • I write code/tests and push my work to be merged.
  • The CI server is triggered, runs the project in an environment and creates a log.
  • It returns either success or failure message.
  • The owner of the project then knows whether my changes are okay or not.
  • He can then merge my changes to the mainline.


Since the code is integrated continuously, it is easier to find where something went wrong. Hence, errors/bugs can be identified earlier. Some of the principles in CI are:

  • A single repository is maintained.
  • Contributors make a clone of it and work on their copies.
  • They test it locally and push to the original repository where a CI server builds it (automated).
  • Automated deployment.

This process saves way much time and effort. When I first had it up and running, I was like this is so cool an so handy. Let’s not waste more time and dive right into how you can integrate Travis-CI or any other CI tool in your project.

Setting Up Travis-CI

Build label

See the above badge. This tells you whether the last build was successful or not. The above build status is for gymkhana_portal.

Now I’ll walk you through how I got it up and running. First off, I should have the following things:

  • A Github account (check)
  • Authorise Travis to use my Github account (check)
  • My repository should be public (check)
  • Working code in my project along with a build/test script (check)

After all this I was able to see my repositories in my Travis profile. Sometimes you might need to sync your account if a repository doesn’t show up. I enabled the repository from the list.

Now I need to add a .travis.yml configuration file to the root of my project which tells Travis how to build the project.


  • L1: Use python as the language for the project.
  • L2-3: This specifies the environments you want to build the project in. Tip: You can add as many as you want. For example, Python 2.7
  • L4-7: Commands which should be run before installing any dependencies.
  • L8-10: Commands to install project dependencies.
  • L11-16: Commands to run/test the project.
  • L17-18: Submit test coverage report after a successful build.

After this, add .travis.yml to git, commit and push, it’ll trigger a Travis build. I can also see the build progress, see commit history for latest build link.

The build log page contains a complete job log along with current status at the top.

It’ll notify you with a success or failure message. In case, the build fails, you can check the log to see what went wrong. Finally, you should see this, and you’re all golden. 😎

And this was it, Travis-CI is now integrated and always ready to build. If you’ve any doubts or suggestions, feel free to comment below!

Leave a Reply

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