What Is a CI Build? Continuous Integration Explained Step by Step

Every time you push code to a project with continuous integration, a server somewhere builds your change from scratch and tells you within minutes whether you broke anything. That run is a CI build, and it is the single cheapest safety mechanism in modern software development. Yet plenty of developers use CI every day without a clear picture of what actually happens between git push and the green tick.

This is the explainer I wish someone had given me earlier: what a CI build is, what happens inside one, and why the discipline around it matters more than the tooling.

What a CI Build Is

A CI build is an automated, repeatable run that takes one version of your code and answers one question: is this change safe to integrate? Concretely, the CI server checks out your commit on a clean machine, installs dependencies, compiles or bundles the code, runs the tests, runs static checks, and reports a pass or fail back to your pull request.

The “I” in CI is the important part. Continuous integration, as Martin Fowler’s canonical article ↗ describes it, is the practice of merging everyone’s work into a shared mainline frequently, at least daily, and verifying every merge automatically. The build is the verification step. Without it, frequent merging just means frequent breakage.

Two things a CI build is not:

  • It is not a deploy. The build verifies a change; deployment ships it. They are separate concerns, often separate pipelines. If you want the shipping side, see our guide to deployment strategies.
  • It is not “running the tests on my laptop”. The clean machine is the point. Your laptop has globally installed tools, stale caches and an environment no one can reproduce. The CI server starts from nothing every time, which is exactly why it catches the bugs your machine hides.

What Happens Inside a CI Build

Almost every CI build, on any platform, follows the same lifecycle:

Trigger Checkout Install Build Test Checks Report

Here is what each stage does, what it catches, and roughly how long it takes on a typical mid-sized web service:

StageWhat happensWhat it catchesTypical time
TriggerA push, pull request or schedule starts the runNothing yet; this is the entry pointInstant
CheckoutThe runner clones your exact commit onto a clean machineMissing files you forgot to commitSeconds
InstallDependencies are installed from the lockfileUndeclared or broken dependencies30s to 2 min
BuildCode is compiled, bundled or type-checkedSyntax errors, type errors, broken imports1 to 5 min
TestUnit and integration tests runBehaviour regressions1 to 10 min
ChecksLinting, formatting, security and licence scansStyle drift, known vulnerabilitiesUnder 1 min
ReportStatus goes back to the commit or pull requestTells humans and branch protection the verdictInstant

Two details in that table do a lot of quiet work. The lockfile in the install stage is what makes builds reproducible: the runner installs the exact dependency versions you tested with, not whatever happens to be newest. And the report stage is what branch protection hooks into, so a red build physically cannot be merged on a well-configured repo.

Most builds also produce artefacts: the bundle, the Docker image, the coverage report. A good pipeline builds these once and reuses them downstream rather than rebuilding at every stage. If you are setting this up from scratch, our walkthrough on how to build a CI/CD pipeline that actually works covers the wiring in detail, and the GitHub Actions patterns guide shows the same ideas in concrete YAML.

Why the Discipline Matters More Than the Tool

The build is mechanical. The practice around it is what delivers the value, and three rules carry most of it.

A red build is everyone’s top priority

The entire promise of CI is that the main branch is always releasable. The moment the team starts merging past a red build, or muting the failing test “for now”, that promise is gone and every later failure becomes ambiguous. Was it your change or the pre-existing breakage? Nobody knows, so nobody fixes it. Fix or revert within minutes; never build on red.

Integrate at least daily

CI is not a server, it is a merge frequency. A feature branch that lives for three weeks gets no benefit from a CI server, because the painful integration still happens, just all at once at the end. The teams that get the most from CI keep branches short-lived and merge to main at least once a day, which is the core argument of trunk-based development ↗.

Keep the build fast

Feedback you wait 40 minutes for is feedback you stop waiting for. Developers context-switch, stack unreviewed changes, and red builds sit unowned. Ten minutes is the ceiling for the blocking path; push slower suites (full end-to-end runs, nightly security scans) out of the inner loop. When your build creeps past that, our guide on how to speed up your CI builds covers caching, parallelisation and test splitting.

One failure mode deserves a special mention: the test that passes locally and fails in CI, or fails one run in five. Flaky tests erode trust in the build faster than anything else, because every red becomes “probably just the flake”. They are diagnosable and fixable, and we have a whole playbook on flaky tests.

A Minimal Real Example

This is a complete, working CI build for a Node project on GitHub Actions. One file, four stages, under ten lines of actual instruction:

# .github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run build
      - run: npm test
      - run: npm run lint

That is genuinely it. npm ci installs from the lockfile, the build catches compile errors, the tests catch regressions, the linter catches drift. Add branch protection requiring this workflow to pass, and your main branch can no longer silently break.

Where to Go From Here

A CI build is a clean-room rehearsal of your change: checkout, install, build, test, checks, verdict. The tooling is a solved problem; the habits are not. Keep the build under ten minutes, treat red as stop-the-line, and merge daily, and you get the thing CI actually promises: a main branch you could ship at any moment.

If you have the build working and want to extend it into delivery, start with building a full CI/CD pipeline. Want practical engineering write-ups like this in your inbox? Subscribe to the Codably newsletter.

Frequently asked questions

What is a CI build in simple terms?

A CI build is an automated run that takes your latest code change, compiles or bundles it, runs the tests and checks, and reports pass or fail. It happens on a server, not your laptop, every time someone pushes code, so the team finds out within minutes if a change broke something.

What is the difference between a CI build and a deployment?

A CI build verifies a change: it compiles the code and runs tests and checks. A deployment ships the verified result to an environment where users can reach it. CI answers 'is this change safe?'; deployment answers 'is this change live?'. Many teams run CI on every push but deploy less often.

How long should a CI build take?

Aim for under 10 minutes for the feedback developers wait on. Past that point people stop waiting, start stacking changes, and broken builds linger. Longer suites (full end-to-end tests, security scans) can run after merge or on a schedule so they do not block the inner loop.

Do I need CI for a solo project?

Yes, and it is cheap to add. Even alone, CI catches the 'works on my machine' class of bug: a missing file, an undeclared dependency, a test you forgot to run. GitHub Actions, GitLab CI and similar services are free for small projects and take one config file to start.

What does it mean when a CI build is red or green?

Green means every stage passed: the code compiled, tests passed, and checks like linting succeeded. Red means at least one stage failed and the change should not be merged or shipped. The whole value of CI rests on the team treating red as stop-and-fix, not as background noise.

Enjoyed this article? Get more developer tips straight to your inbox.

Comments

Join the conversation. Share your experience or ask a question below.

0/1000

No comments yet. Be the first to share your thoughts.