First steps with continuous integration

Posted on

What a word: Continuous Integration or in other words “Don’t break the build, damn it!”. For my project on hearing aids, I decided to give a try to the continuous integration service that we can find on internet. I didn’t make a thorough search of these services.

There is a handful well-known on the web:

If you have the time and experience to run your own server, I think Jenkins would be the option of choice as it’s open source and can be installed anywhere (using Java). Unfortunately, I had to make a choice as I’m alone on my project, I can’t fight all the battles at the same time. I made the choice to concentrate on the project that is the first priority at the moment. So, I was left between Travis and Circle. I chose Travis because it seems a bit more known than Circle and they have a direct interface with Github repositories and Git, if you have a open source repository, you can use freely their infrastructure and it seems really easy to integrate into the project using the .travis.yml file.

Travis and portaudio

I’m not going to much in details here on how to use Travis, there are plenty of tutorial everywhere and the actual documentation of the service. Just few things to know beforehand. First, be careful with the tutorials on internet, many of them are outdated and use an old API. The most important thing is for those who want to build their project using Portaudio. You can either ship the portaudio library within your project or you can tell Travis to install the necessary packages.

Build tests under GNU/Linux are using a flavor of Ubuntu. Maintainers under Debian and derivative made the choice of separating the main packages into the package by itself and the development package. Personally, I don’t see the point in doing that. They probably have a good reason and you have to deal with it. Period. Moreover, Ubuntu ship several versions of Portaudio with non homogeneous names. So here we are! Portaudio needs the following libraries to work correctly:

  • asound (for ALSA)
  • m
  • pthread
  • jack [optional]

The Ubuntu flavor used by Travis-ci already ships m, pthread and asound ( through libasound2). It’s not enough because you need the development version of asound called libasound2-dev. Secondly, regarding the available packages of Portaudio, I would recommend to use the V19 version that is lastest stable release. On Ubuntu, you will need only the development part but because it doesn’t make sense to me, I recommend to install both packages such as:

  • libportaudio2
  • portaudio19-dev

the libportaudio2 corresponds in fact to the V19 version of portaudio. In fine, this part of my .travis.yml file looks like this:

    - sudo apt-get update -qq
    - sudo apt-get install -y libportaudio2 portaudio19-dev libasound2 libasound2-dev

Future steps

In my opinion, there are many things to do with this tool. The most important one is to run automatic tests for regression issues and ensure a proper build before pushing the master and release the software. This means, on my side, to start writing unit tests for my code and try as maximum to push for a TDD approach that I think is very useful and prevent for regression issues.