Skip to content

Continuous Integration (CI)

In one line

CI automatically builds and tests code on every push, preventing broken code from merging into the main branch.

In simple words

Continuous Integration (CI) is the practice of automatically building and testing code every time someone pushes changes. Instead of integrating changes manually at the end (which leads to merge hell), CI integrates continuously — every push triggers an automated pipeline.

A typical CI pipeline:

  1. Trigger: Someone pushes code or opens a pull request.
  2. Checkout: The CI system gets the code.
  3. Install: Install dependencies.
  4. Build: Compile/build the code.
  5. Test: Run the test suite.
  6. Report: Report success or failure.

If any step fails, the pipeline stops and the team is notified. The code cannot be merged until the pipeline passes. This catches bugs, broken builds, and failing tests immediately — not days or weeks later.

Popular CI tools: GitHub Actions, GitLab CI, Jenkins, CircleCI.

Example

yaml
# .github/workflows/ci.yml — GitHub Actions CI
name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test
      - run: npm run build

# Every push triggers: checkout → install → test → build
# If any step fails, the PR is blocked from merging.

A CI pipeline (here GitHub Actions) runs automatically on every push: it checks out code, installs dependencies, runs tests, and builds. If any step fails, the pull request is blocked from merging.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary