Continuous Integration (CI) - An Introduction

3 minute read

A software development team can benefit from many methodologies that will save them time and repetitive work. As an example, there is continuous integration, continuous delivery and continuous deployment. Methods and techniques like these represent ways to accelerate the delivery of new versions of the application, and are aligned with the agile methodologies.

Continuous integration (CI) is a software development practice that aims to make code integration more efficient, through automated builds and tests.

In agile methodology, one of the proposals is that the software development process should be carried out with more frequent deliveries.

As a consequence, the work required to gather, integrate and test all the code developed by the team in a central repository has also to become more frequent.

In the words of Martin Fowler:

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

In this context, Continuous Integration helps to reduce the manual work required in the code integration process. In addition, with test automation, bug fixing work is made easier, ensuring that the software is working after each change.

To adopt Continuous Integration, it is essential to use version control tools, such as Gitlab or Github.

The process of integrating software continuously is, first of all, a matter of communication, and for that everything must be adequate, with automated tests and automated builds.

The one prerequisite for a developer committing to the mainline is that they can correctly build their code. This, of course, includes passing the build tests. As with any commit cycle the developer first updates their working copy to match the mainline, resolves any conflicts with the mainline, then builds on their local machine. If the build passes, then they are free to commit to the mainline. - Martin Fowler

Tools for Continuous Integration

With the mentioned steps already implemented, it is time to implement a continuous integration tool. There are several of them, such as Jenkins, TravisCI, CircleCI, Bitrise, etc. Some of them are cloud-based, and others are server-based.

Many of them are free for open source projects and easy to configure. Of course, each team must choose the one that better fit their needs. The key to good integration, as seen earlier, is a version control environment, a well-defined workflow, automated builds and tests.

The tools for continuous integration come in to make the process simpler, and allows the configuration a wide set of requirements, such as:

  • The development environment
  • The automated build system
  • The automated code formatting
  • Integration with the version control repository
  • Notification emails (in case of errors)

Benefits

For the development team, the integration, delivery and continuous deployment practices allow minimized work, reducing errors and making the software available in shorter cycles.

For the business, the main benefit of using these approaches is to decrease the time required to release product updates.

In competitive markets, this represents a major advantage for companies that want to quickly meet the demands of their users.

In addition, by making new * features * available to users more often, the company has the possibility to make its upgrading cycle more efficient.

Conclusion

Continuous integration with automated tools has several benefits, as we have seen. First is that teamwork generates fewer errors, which reduces risks, because as the system is integrated continuously and quickly, errors are also detected at the same speed.

The bugs, in this format, do not accumulate, not creating a general problem in the system, because instead of taking a day or a week, the error is detected in hours. Because even if the code is tested, errors can arise upon integration and the sooner the errors are detected, the sooner they will be corrected.

If you want more Information on this subject, I recommend the very comprehensive article written by Martin Fowler.