How does continuous integration work ?

The benefits of continuous integration become more evident as the people working on a same project increases, but it doesn't mean it's useless in a solo project.

Purpose of continuous integration is, as the name suggest, integrate all code developed in different environments into a single and shared repository several times a day. This allows teams to actively detect integration conflicts at early stage and resolve them.

CI emphasizes on periodical, automated builds often with post-build scripts to perform tasks such as unit testing or other checks. Say I committed a change in the code that will break my co-worker's feature. Normally, this bug will be detected in the QA period or live in production, but since we have hourly builds paired with proper unit-testing, the latest build will fail since my code didn't pass some test cases. This doesn't mean that CI will catch all bugs - it won't, it all depends on how thorough you are with your post-build checks.

In sum, CI attempts to delivers in a periodical manner an environment more truthful to the production environment that the ones the developers use, which makes it more suitable for testing and create release candidates but not for developing.

Continuous integration is often coupled with continuous delivery — code is pushed into production on short cycles. The idea is to ensure that the software is in a state that can be reliably pushed to production at any point in time. Because development branches are tested and integrated frequently, there are, in theory at least, rarely any integration issues — a problem that plagues development processes with long integration cycles.

Any integration issues that do arise dealt with quickly, and are likely to be relatively trivial, keeping the costs of integration down. All of which sounds pretty great, but what are the advantages of continuous integration for development teams?

Developer time is focused on work that matters — Much of the work of frequent integrations is handled by automated build and testing systems, meaning developer time isn't wasted on large-scale error-ridden integration.

Software quality is improved — Any issues are detected and resolved almost immediately, keeping software in a state where it can be safely released at any time.

Faster Development - Integration costs are reduced both because serious integration issues are less likely and because much of the work of integration is automated.
Continuous Integration is used to ensure a fool proof automation for collaborative process during project development.CI ensures that project is, at every stage (to be defined by team), in a state where it has been,

  • Merged/Integrated across the board
  • Checked for various quality/syntactic/semantic metrics
  • Unit Tested (TDD)
  • Built to Run
  • Deployed

So, all this workflow is automated and executed appropriately.