Continuous Integration
External
- Continuous Integration by Martin Fowler
Internal
Overview
Continuous Integration (CI) is an agile software development practice that involves the following:
- Verification of the build integrity by checking if the source code can be pulled from the code repository, built, and packaged in form of immutable artifacts.
- Running and validation of the unit tests. The build process executes all unit tests created by developers and validates the test results. This step ensures that the source code was not broken as a side effect of the commit.
- Running and validation of the integration tests.
- Identification of problems and alerting the teams.
- Packaging validated functionality into immutable artifacts and publication of those artifacts in delivery repositories.
The essence of continuous integration is to test every change, as soon as possible and provide rapid feedback to any problems that was introduced by commits. Continuous integration is primarily focused on asserting that the code compiles successfully, passes a body of unit and integration tests and can be packaged in a standard format.
In the DevOps culture, CI is mandatory, and it performed automatically by a tool that runs automation scripts to eliminate all human intervention during the CI process.
The CI process requires a source code repository and a continuous integration server, that pulls code from the source repository and runs the build. Developers must check in as often as possible, every time a new piece of functionality that is verified by unit tests that pass is added. The build must be completely automated and must run without human intervention, and it must be fast.
Testing - especially the integration testing - must be done in an environment that is as close to production as possible, though there are situations when later stages that are part of continuous delivery are better suited for complex high level testing in environments similar to production.
The CI process provides rapid feedback on the state of the project, each unit test or integration test-verified assertion that gets broken by a commit is immediately shared with the entire development team. The process is run every time there's a commit, presumably many times a day. Every member of the team must be able to easily access the build results.
The build process should generate software that can be deployed at any time - a good release candidate.
Jenkins is a Continuous Integration engine that can be adapted to drive Continuous Delivery too.
SonarQube is a static code analysis tool.
Continuous Integration Pipeline
Tools
The software that can be used to implement a continuous integration pipeline is known as a build server:
- Jenkins
- Team City
- Bamboo
- GitHub Actions
- Cloud Platform Services