Skip to content

Continuous integration

Also called: CI

Published:

How does continuous integration work?

In Martin Fowler's description, every member of a team merges their changes into the shared codebase frequently, at least daily. Each integration is verified by an automated build that includes the tests [1]. GitHub's documentation puts the same idea simply: committing code to a shared repository often means errors surface sooner [2].

That check is usually triggered by an event. In GitHub Actions, a workflow can run whenever new code is pushed to the repository, and the test results show up in the pull request, so you can see whether a branch introduces an error before it is merged [2].

Where did the practice come from?

Continuous integration was originally developed as part of Extreme Programming. Fowler credits Kent Beck with defining it in the 1990s [1].

What happens when the build breaks?

Fowler says a failed integration build should be fixed straight away, quoting Beck: nobody has a higher priority task than fixing the build [1]. Say a morning commit breaks one of the tests. The team either fixes the fault at once or reverts the commit, and Fowler often recommends reverting, because it lets everyone else keep working on a healthy codebase [1].

Frequently asked questions

Is CI the same as CD?

No. CI is about merging changes often and verifying them with automated tests. CD is the next step, focused on delivering or deploying the verified code.

Do you need a special tool for continuous integration?

The core of the practice is frequent merging and an automated build. Tools such as GitHub Actions make it easy to run that build on every push.

Sources

  1. Continuous Integration — martinfowler.com
  2. Continuous integration — GitHub Docs

Related terms