Skip to content
Careersintermediate

What is continuous integration?

Updated Nov 30, 20263 min readBased on official documentation
What is continuous integration?

In short

Continuous integration is a practice where every developer merges their code into a shared main branch often, at least once a day, and an automated build and tests check each change. Problems show up in minutes, not months, which keeps the shared code working and easy to change.

The problem it solves

Imagine several developers working on the same product for weeks, each in a separate copy of the code. When they finally combine their work, conflicts and hidden bugs pile up. Nobody knows how long the merge will take. Continuous integration, often shortened to CI, is a habit that prevents this. Everyone on the team merges their work into one shared main line of code frequently, and an automated process checks each merge.

The author of the source article describes a team that spent months integrating separate units of code. The lesson he draws is simple: integration becomes a long, unpredictable task when it is rare. Doing it often keeps each step small.

How it works

A developer starts by copying the latest shared code to their own machine. They make a change, then run a build. A build is the process that turns source files into a runnable product, and it usually runs the automated tests too. When the tests pass, the developer pulls the newest shared changes again, combines them with their own work, and builds once more. Only then do they push their change to the shared repository.

Pushing is not the end. A separate CI service notices the new change, takes a clean copy of the code, and builds it on its own machine. This matters because a build that works on one laptop can still fail somewhere else. The CI service then reports whether everything is well. If it fails, the team fixes it quickly, while the change is still fresh in everyone's mind.

The whole cycle for one small change can take a few hours of work, and the central checks take minutes. That is the core idea: a developer's work stays close to the shared state of the project.

Core practices

Teams that do CI well tend to follow a few shared habits:

  • Keep all source code in one version control system, such as Git, so anyone can see the current state and its history.
  • Merge to the shared main branch at least once a day. Some people call this trunk-based development.
  • Build and run the automated tests before pushing, and keep them fast enough that people run them often.
  • Treat a broken build as the top priority. Fix it or revert the change before anyone adds more work on top.
  • Make sure a new team member can get a working build from a fresh machine with only the basic tools installed.

The last point is a simple test of whether the setup is complete. If a build depends on things that only exist on one person's computer, the CI service will eventually catch it, and the cost is a lost afternoon.

When to use it

CI fits almost any team that writes shared software. It is most useful when several people change the same code, or when the product is released often. Small teams benefit too, because a quick check saves them from fixing problems that have had days to grow.

CI does need some setup. A team needs version control, a build script and a reasonable set of automated tests. Without tests, a green build means little, so the checks are only as good as the tests behind them. Teams that are just starting may add tests and a build script first, then add the CI service once those are stable.

Common mistakes

A common mistake is calling a setup CI when developers only merge once a week or only run the tests after the code is already shared. In that case the integration problems still wait until the end. Another mistake is letting a failing build stay broken while people keep merging on top of it. This hides the real cause and makes every new failure harder to trace.

Teams also sometimes skip the steps on a developer's machine and rely on the CI service alone. That slows feedback, because each problem then waits for a remote build. Running the build locally before pushing catches most issues early.

Some teams use long-lived feature branches and merge them only when a feature is finished. This can feel safer, but it often recreates the big, painful merge that CI is meant to avoid. Continuous delivery goes one step further than CI. It keeps the product in a state where it could be released at any time, usually with an automated pipeline for deployment. Teams often adopt CI first and add delivery later, once the basics are reliable.

For the original explanation, read the full article by Martin Fowler at https://martinfowler.com/articles/continuousIntegration.html. It covers the history of the practice and offers more detail on each habit.

FAQ

Does continuous integration mean I push code many times a day?

The source recommends integrating at least once a day. Many teams do it more often, because smaller merges are easier to check and fix. The key is that the work stays close to the shared main branch.

Do I need a special CI tool to start?

No. The core idea is a shared repository, frequent merges and automated builds. A CI service makes the checks run automatically, but the habit matters more than the tool. The source notes that CI is not the result of an expensive or complex tool.

What happens when the CI build fails?

The team should fix it quickly, or revert the change that broke it. Working on top of a failing build makes it hard to tell which change caused the problem.

Is continuous integration the same as trunk-based development?

In many discussions the two terms refer to the same practice of integrating into one shared main line often. Some teams use the names differently, so it helps to check what a team means.

Sources

This page is based on the official documentation below. Read it for full detail.

Continuous integration — official documentation ↗
blozhikDeveloper news from across the web, explained. Every story links to its original sources.