Click here to share this article on LinkedIn »

What is continuous integration? On Wikipedia we can read:

In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.[1] Grady Booch first named and proposed CI in his 1991 method,[2] although he did not advocate integrating several times a day. Extreme programming (XP) adopted the concept of CI and did advocate integrating more than once per day — perhaps as many as tens of times per day.[3]

Thus basically CI from our source code can build target application (executable) frequently (in best case after each commit). This can be done by several ways like simple scripts or by software created specially for that purpose. We should be notified about status of build process (especially when build fails) — and this is one of most important purposes of CI.

I would like to connect my Swift project (which I’ve described in my previous articles) to some CI system. I don’t want to create new CI service (on premise) but I would like to use some existing online services. My continuous integration system should contains following features:

verify build — system has to build source code and verify status of the compilation

— system has to build source code and verify status of the compilation run unit tests — system has to execute all unit tests and notify about failing tests

— system has to execute all unit tests and notify about failing tests verify code coverage — system has to calculate code coeverage

— system has to calculate code coeverage check code complexity — system has to calculate code complexity of source code

Unfortunately there is no one online system that fulfill all that requirements. However we can choose a set of services that together will support all required features. First we have to choose system which will build our code and run unit tests.

List of free (for open source projects) CI online services:

Travis CI — free for open source projects, supports macOS and Linux

CircleCI — the first container is free, macOS starts from $39/month

AppVeyor — free for open source projects, mostly for Windows developers (AppVeyor for Linux is currently in private beta)

It’s much esier when we are working on some most common programming language like Java/C# etc. For my C# projects I used AppVeyor service, however for this project I decided to use Travis CI which supports macOS for open-source projects for free.

For code coverage we can use service: Codecov and for code complexity: Codebeat service.

I will describe below how I connected my source code with all that services.