Continuous Integration or CI is a software engineering practice of merging all working copies of code into a shared repositories frequently, preferably as soon as the code change is verified for correctness.
A key benefit of doing this is that errors can be detected quickly and it becomes easy to debug and fix them — since each change introduced is small, and it’s easier to vet small changes as compared to large ones.
A complementary practice in CI is to add test coverage alongside the proposed change. Typically, developers ensure that unit tests are present and passing for the proposed change. Integration tests are usually run automatically on a CI server whenever the change is pushed to upstream.
What are the benefits of Continuous Integration?
- Since code changes are tested more frequently and in small chunks, defects and integration issues are detected very early and can be fixed easily.
- While it can be counter-intuitive to imagine, CI enables teams to deliver products and iterate faster. By definition, the distance between the application in production and the working copy of a developer is very short. It allows developers push small changes very easily and iterate without worrying about long release cycles.
- Risk of application unavailability is reduced dramatically, since it become easy to maintain a stable build of an application without affecting development.
- Paired with Continuous Quality, it becomes easy to track key source code metrics such as test coverage, code complexity, critical issues and potential debt areas on every small change. This helps teams focus on what is important.