Before CI/CD, developers would work on features for weeks, then spend days merging everyone’s code together and praying nothing broke. CI/CD fixes that by automating the boring stuff — building, testing, and deploying — so we can ship fast without losing sleep.
What Is CI (Continuous Integration)?
Every time someone pushes code, the system automatically builds and tests it. That’s CI.
The goal is simple: catch bugs early, when they’re cheap to fix. If we push broken code at 10am, we know by 10:02am instead of finding out three weeks later during a manual QA pass.
Key ideas:
- Everyone merges to the main branch frequently (at least daily)
- Every push triggers an automated build + test run
- If tests fail, fixing the build is the top priority
What Is CD (Continuous Delivery vs Continuous Deployment)?
Here’s where people get confused — CD means two different things.
Continuous Delivery — code is always in a deployable state. After passing all tests, it’s ready to go to production, but a human clicks the “deploy” button.
Continuous Deployment — takes it one step further. Every change that passes the pipeline goes straight to production. No human in the loop.
In simple language, delivery means “we can deploy anytime,” and deployment means “we do deploy every time.”
The Pipeline Mental Model
Think of a CI/CD pipeline like an assembly line in a factory. Code moves through stages, and if it fails any stage, it stops.
Why It Matters
- Catch bugs early — a failing test at push time is way cheaper than a bug in production
- Faster releases — no more “release weekends” with the whole team on standby
- Confidence — if the pipeline is green, we know the code works
- Smaller changes — frequent deploys mean smaller diffs, which are easier to review and debug
A Minimal Pipeline Example
# .github/workflows/ci.yml — simplest possible CI pipeline
name: CI
on: [push, pull_request]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # grab the code
- uses: actions/setup-node@v4 # install Node.js
with:
node-version: 20
- run: npm ci # install deps (clean)
- run: npm run build # build the project
- run: npm test # run tests
This runs on every push and every PR. If any step fails, the whole job fails and we get notified. That’s CI in its simplest form — push code, get feedback fast.