Continuous Integration (CI)

Roller Coaster - Looping

Large software projects require a group of programmers. Everybody is focused on their own coding part and it may take quite a while to complete it. But what happens when the individual pieces are merged? The integration of the puzzle pieces in a system can be very time consuming and complex. The nightmare scenario would be, if the integration takes months. You may think I am kidding but that is exactly what happened in some companies that were not using CI, in the past. CI is a software development practice that requires developers to merge their work frequently into a shared repository.
The problem of integration errors is already known, since people started developing software. But the first article about Continuous Integration  was written by Martin Fowler in 2000.

 

How does a CI process look like?

 

CI-System

First of all there is a central code base. Every programmer continues developing their code and everyone is required to integrate their work into the code base frequently, at least daily. Make sure that every task is small and self-contained, this will simplify the integration.

The codebase is housed in a Version Control System (VCS). It may be a centralized system like Subversion or a distributed system like Git. A Version Control System manages changes.

All changes are assigned to a user, identified by a reversion number and finally stored in the system.Version Control System also allows you to restore any previous version of your code. Once a developer integrates their work into VCS, the CI server will be informed. By the way, the integration of the source code is called commit.

continuous integration system by Marina Kettschik
continuous integration system
The CI server fetches the current software version and starts the build process (build automation). In addition to the code compilation there are automated unit tests (test automation). Nevertheless, a code review makes only sense if its result, particularly its failure, will be announced. For this reason, the CI server creates a report of the build and tests.

The CI system is a part of the development process and the team. To ensure this, the access must be simple. Not only the development teams interact with the system. The CI system informs their colleagues automatically about the results of their work. In that case, it allows the developer to detect integration errors and fix them as quickly as possible.

 

CI-Server

The CI server is the main part of the system. It observes the changes of the Version Control System. It initializes the builds, tests and notifies the developer about the result via e-mail, for example. For this reason, the choice of CI server should be considered carefully. There is a wide selection of CI servers and each one has its own disadvantages and advantages. Some are for a given platform, like the Team Foundation Server for Windows. For people with experience and a preference to work with XML files, CruiseControl from ThoughtWorks Studios could be a good choice. Martin Fowler has been involved in the development of CruiseControl and used it himself. Another choice could be Jenkins. It is for free, based on Java, like CruiseControl, also open source, has a great popularity and is especially suitable for beginners.

Finally, various aspects can be important in the decision, besides the platform. One aspect can be to choose an open source software or a proprietary software. Another question would be, if you host it on your own server or use Software as a Service (SaaS) and let other instances host it for you. Or if the CI server supports Continuous Delivery (automated release creation) or plug-ins for special requests.

 

Summary

Continuous Integration is an important part of the current software development. The question is, if the setup is worth it even for small projects. Taking a closer look, you will notice that the use of a version control system is already a part of development. Even without using a CI server the workflow of a developer is similar to it. The developer finishes their work and fetches the current source code from VCS. They build and test the project with their functions. With a faultless result, the source code will be commited to the VCS. With large projects, a CI server offers you several advantages. The process is automated, the error rate is minimized and the quality of the product increases, for example.