What is Continuous Integration?

Published Updated

8 min read

Many people know about continuous integration but don't know how amazing it is. When multiple developers work on the same project, they change a shared main branch at overlapping intervals. Developers create branches for their work and merge them back when a feature is done. Every branch starts as a copy of main, but main keeps changing, so the longer a branch lives, the less it looks like the current code. When the time comes to merge, this divergence causes trouble: bugs, merge conflicts, bottlenecks, or even a complete halt in development. Continuous integration fixes this by merging small changes often and checking every one of them automatically.


What is Continuous Integration?

Continuous Integration, or CI, is a development practice where every member of the team merges their changes into the main branch often, at least daily, and every change is automatically built and tested. Martin Fowler, who popularized the term, describes it in his article on continuous integration. This allows you to catch bugs early, reduce merge conflicts, and have confidence that your software is working.

While the details vary depending on your development environment, most CI systems share the same basic tools and processes. In most scenarios, a team practices CI together with automated testing as part of a CI/CD pipeline that runs either in a service built into the code hosting platform or on a dedicated CI server.

Whenever a developer pushes new code to a branch or opens a pull request, the CI system automatically builds and tests it to determine whether it works and can be integrated with the code on the main branch. The result of every run is shown right next to the commit and the pull request: passed or failed, with logs for every step.

By exposing build and test information for every commit on every branch, CI paves the way for what’s known as Continuous Delivery, or CD, as well as a related process called Continuous Deployment. CI is also where tooling and people meet: you can read more about why the interaction between developers and system administrators matters in our article on DevOps teamwork.

Continuous Delivery and Continuous Deployment

So, what’s the difference between Continuous Delivery and Continuous Deployment? Continuous Delivery is the practice of developing software in such a way that you could release it at any time. When coupled with CI, Continuous Delivery lets you develop features with modular code in more manageable increments. A person still decides when to release, usually with a single click.

Continuous Deployment is an extension of Continuous Delivery. Every change that passes the pipeline goes to production automatically, with no manual release step. It lets you ship newly developed features with confidence and little or no downtime, but only if your tests are good enough to be trusted with that decision.

How does Continuous Integration (CI) work?

Now, let’s take a look at how GitHub (GitLab, Bitbucket or any other platform) fits into this process. Let’s take it one step at a time. GitHub is like a clearinghouse for your code. Developers make changes locally and push those changes to GitHub when they want to share them with others. With Continuous Integration, each of these changes triggers a pipeline that decides whether it can be merged into the main branch. If your local branch has drifted from the remote, here's how to force a git pull without losing work.

Today there are two common ways to run that pipeline.

CI built into the platform

Most teams now run CI right where the code lives: GitHub Actions, GitLab CI/CD or Bitbucket Pipelines. The pipeline is a YAML file in the repository, so it's versioned and reviewed like any other code. You don't need a separate server or a webhook: a push or a pull request starts the pipeline, a hosted or self-hosted runner executes the steps in a fresh environment, and the result appears on the commit and the pull request.

An external CI server

Some teams keep a dedicated automation server, for example Jenkins, Buildkite or TeamCity. Here GitHub uses so-called webhooks to send messages to external systems about events in your projects. You subscribe the CI server to receive a message every time someone pushes code to a branch or opens a pull request. The CI server parses the message, grabs the current copy of the project, builds the branch and runs the tests.

When the CI server finishes, it reports the result back to GitHub. A CI tool installed as a GitHub App uses the Checks API, which supports detailed reports, annotations on specific lines of code and re-runs from the GitHub interface. Other integrations use the simpler commit statuses API, which only marks a commit as pending, success, failure or error, with a link to the details. Either way, GitHub shows the result next to the commit and the pull request, so you know which changes can be merged and which ones need a bit more work.

Making checks required

A red check only helps if nobody can ignore it. With protected branches or rulesets, you can require specific status checks to pass before anything is merged into main. On a busy repository, a merge queue goes one step further: it tests each pull request together with the latest main branch and the pull requests queued ahead of it, so main stays green.

A working GitHub Actions example

Here's a minimal but complete CI setup for a small Node.js project. It runs on every push to main and on every pull request, installs dependencies, checks the code and runs the tests on two Node.js LTS versions. The workflow was checked with actionlint, and its steps were run locally in Docker on Node.js 24 and 26.

Step 1. The code and a test

A function in src/price.js:

typescript

1export function addVat(net, rate = 0.2) {
2 if (net < 0) throw new RangeError('net must be >= 0');
3 return Math.round(net * (1 + rate) * 100) / 100;
4}

A test for it in the test folder, using the test runner built into Node.js:

typescript

1import { test } from 'node:test';
2import assert from 'node:assert/strict';
3import { addVat } from '../src/price.js';
4
5test('adds 20% VAT by default', () => {
6 assert.equal(addVat(100), 120);
7});
8
9test('rejects negative amounts', () => {
10 assert.throws(() => addVat(-1), RangeError);
11});

And package.json with two scripts the pipeline will call:

typescript

1{
2 "name": "ci-demo",
3 "version": "1.0.0",
4 "private": true,
5 "type": "module",
6 "scripts": {
7 "lint": "node --check src/price.js",
8 "test": "node --test"
9 }
10}

Run npm install once and commit the generated package-lock.json too. The pipeline uses npm ci, which installs exactly what the lock file says and fails without it.

Step 2. The workflow

Save this as .github/workflows/ci.yml:

yaml

1name: CI
2
3on:
4 push:
5 branches: [main]
6 pull_request:
7
8permissions:
9 contents: read
10
11jobs:
12 test:
13 runs-on: ubuntu-latest
14 strategy:
15 matrix:
16 node-version: [24, 26]
17 steps:
18 - uses: actions/checkout@v7
19 - uses: actions/setup-node@v7
20 with:
21 node-version: ${{ matrix.node-version }}
22 cache: npm
23 - run: npm ci
24 - run: npm run lint
25 - run: npm test

What each part does:

  • on starts the workflow on pushes to main and on every pull request.
  • permissions gives the job read-only access to the repository. Start with the minimum and add more only when a step needs it.
  • matrix runs the same job twice, once per Node.js version, in parallel.
  • actions/checkout gets the code, and actions/setup-node installs Node.js and caches npm downloads between runs.
  • The last three steps are the same commands a developer runs locally.

Step 3. Check it before you push

A typo in a workflow file only shows up after you push it. actionlint catches syntax errors, unknown properties and broken expressions locally. It runs in Docker without installing anything:

shell

1docker run --rm -v "$PWD":/repo -w /repo rhysd/actionlint:latest -no-color .github/workflows/ci.yml

No output and exit code 0 mean the file is valid. To run the pipeline steps themselves the way a clean runner would, start them in a fresh container:

shell

1docker run --rm -v "$PWD":/src:ro node:26 bash -c 'cp -r /src /w && cd /w && npm ci && npm run lint && npm test'

shell

1> ci-demo@1.0.0 test
2> node --test
3
4✔ adds 20% VAT by default (0.299875ms)
5✔ rejects negative amounts (0.165083ms)
6ℹ tests 2
7ℹ suites 0
8ℹ pass 2
9ℹ fail 0

If a test fails, npm test exits with code 1, and on GitHub the job, the check and the pull request turn red. That's exactly what you want: the broken change stops before it reaches main.

Step 4. Make the check required

Push the workflow, open a pull request, and wait for the first run. Then go to the repository Settings, open Rules (rulesets) or Branches (branch protection) and require the test checks to pass before merging into main. From now on, nothing gets merged with failing tests.

Containers make this even more reliable: when the build runs inside a Docker image, CI, developers' laptops and production all use the same environment. If that's new to you, start with our guide on what Docker is and how it works.

How does Continuous Deployment (CD) work?

Continuous Deployment works in a similar way. You add a deployment job that runs only on the main branch and only after the tests have passed. In a simple setup: every time the main branch receives a new commit, the pipeline builds the project and deploys it to production. In GitHub Actions, environments add protection rules on top, such as required reviewers or a wait timer before a deploy to production. The details of the deployment itself depend on your software and where it runs.

If your project requires more flexibility, GitHub also exposes a Deployments API. It gives you the ability to create custom deployments from branches, tags or commits. You can use the Deployments API together with webhooks to notify third-party systems, which can then retrieve a copy of the code from GitHub and deploy the version you request to the environment you specify.

Wrapping up

So, let’s review all of that one more time. Continuous Integration is a practice of merging small changes often and checking each of them automatically, so new code always integrates with the current version of the software. Continuous Delivery keeps the software ready to release at any time, and Continuous Deployment releases every change that passes the pipeline. GitHub (or any other platform) puts your code at the center of your development ecosystem: it runs the pipeline itself or talks to external CI systems through webhooks and APIs, and blocks merges that break the build.

If you'd rather have someone build and maintain these pipelines for you, take a look at our DevOps automation and CI/CD services.

Alex Kondratiev

Alex Kondratiev

Founder and CEO of ITsyndicate. DevOps engineer with 15+ years in cloud infrastructure, Infrastructure as Code, Kubernetes and automation, focused on secure, scalable and resilient systems.

More about Alex

An Infrastructure Review Should Give You a Plan, Not a Dependency

Why we want the review to be useful even if your own team does all the work afterward. Of course we want to help with the implementation. We are an engineering company. We like solving infrastructure problems, and we want relationships where we can take responsibility for the work over time. So why offer an Infrastructure Review that a client can take back to their own team? Because I want the first engagement to earn its fee on its own. The client should leave with a better understanding of their situation, clear priorities, and a practical next step. They can then decide whether they want us to carry out the changes. That is the principle behind how we are building our Infrastructure Review. It shapes what we agree to investigate, how we explain our findings, and what the client can do with them afterward.

Your Infrastructure Can Be Expensive Even When Nothing Is Broken

A quiet production environment can still hide rising costs, wasted engineering capacity, and risks that appear only during growth or recovery. A familiar weekly update sounds like this: production is stable, the latest release went out, and there were no serious customer complaints. The cloud bill is higher again, but there is probably a reasonable explanation. One engineer spent half a day helping with the release, another fixed a monitoring issue, and the database may need attention next quarter. Nothing is broken badly enough to become a leadership problem. That is exactly why the underlying problem can survive for so long. I have seen this pattern more than once. Production looks stable, while senior engineers quietly spend much of their time keeping it that way. The platform works, but the company is paying for that stability through cloud spend, manual effort, slower releases, and assumptions about growth or recovery that nobody has tested recently. Infrastructure doesn’t need to cause an outage to become expensive. Outages are obvious. Inefficiency is quieter, and it can keep working for years while charging you for the privilege.

How to Run a Docker Container on Your Local Machine

This article is a quick, hands-on guide to running Docker locally. It walks through essential CLI commands for managing images and containers (build, pull, run, ps, start/stop, rm/rmi) and shows how to automate image creation with a Dockerfile. You’ll build an image, run a container with port mapping, verify it’s running, and learn tips for environment setup - everything you need to spin up and manage local containers efficiently.

Stay online.
Stay in command.