Skip to main content

Infrastructure and deployment

What is CI/CD?

Definition

CI/CD is the practice of automatically building and testing every change, then automatically packaging and releasing the changes that pass.

Also known as: Continuous Integration, Continuous Delivery, Continuous Deployment

CI/CD in more detail

Continuous integration is the first half: everyone merges into the shared main branch often, and every push triggers an automated build, test and lint run. The value is the speed of the feedback loop — a change that breaks something is identified within minutes, while the author still remembers what they did, instead of surfacing during an integration week months later.

The second half splits into two things people frequently conflate. Continuous delivery means every change that passes the pipeline is automatically packaged into a deployable artifact and proven releasable, with a human choosing when to push the button. Continuous deployment removes that button: passing the pipeline is the decision, and the change goes to production on its own. Same pipeline, one difference — whether a person approves the final step.

A pipeline is a sequence of stages that fails fast: install and cache dependencies, lint, unit tests, build, integration tests, security and dependency scanning, then deploy to staging and production. Making it trustworthy is mostly about determinism — pinned dependency versions, ephemeral runners, no reliance on the state of a previous run — because a suite that fails randomly gets ignored, and an ignored pipeline provides nothing.

Deployment safety is the part beyond the pipeline itself. Blue-green keeps two environments and switches traffic; canary sends a small percentage to the new version and watches error rates before continuing; feature flags separate deploying code from releasing behaviour, so a rollback becomes a configuration change instead of a redeploy.

CI/CD example

# .github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci          # exact lockfile versions
      - run: npm run lint
      - run: npm test -- --coverage
      - run: npm run build

  deploy:
    needs: test              # only if the tests passed
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - run: ./scripts/deploy.sh production

CI/CD — common questions

What is the difference between continuous delivery and continuous deployment?
Both automate everything up to production. Continuous delivery stops at a manual approval, so releasing is a human decision; continuous deployment releases automatically whenever the pipeline passes. The pipeline is identical — the difference is that one gate.
What does CI actually run?
Whatever proves the change is safe: dependency install, linting, type checks, unit and integration tests, a production build, and usually security and dependency scans. The rule is that it must be fast enough to run on every push and reliable enough to be believed.
Why do flaky tests matter so much in CI?
Because a suite that fails at random trains everyone to re-run it rather than read it, and once red is normal a real failure passes unnoticed. Flaky tests should be quarantined and fixed as a priority, not retried.

Keep reading

Every definition in the set is indexed A-Z in the developer glossary, and the cheat sheets cover the syntax once you know what you are looking for.

Browse the A-Z glossary