What Is CI/CD
CI/CD automates building, testing, and deploying every change so shipping is safe and boring.
Continuous Integration (CI) means every commit is automatically built and tested. Continuous Delivery/Deployment (CD) means passing changes are automatically shipped toward production. Together they turn deployment from a scary manual event into a routine, automated one.
Why it matters
- Bugs are caught in minutes, not in production.
- Deploys are small and frequent, so each is low-risk.
- The process is documented in code, not in someone's head.
Example
# The universal shape of any pipeline
stages:
- checkout # get the code
- build # compile / bundle / build image
- test # unit + integration tests
- deploy # ship the artifact to AWSWhen to use it
- A team configures CI to run unit tests on every pull request so broken code is caught before it ever reaches the main branch.
- A startup uses CD to deploy to staging automatically after every merge so the latest version is always available for stakeholder review.
- An ops team adds a manual approval gate before the production deploy stage so a human must confirm before code goes live.
More examples
Simple CI pipeline concept in bash
Shows the three fundamental CI stages — lint, test, and build — that must all pass before code is deployable.
#!/bin/bash
# Minimal CI steps: lint -> test -> build
set -e
npm run lint
npm test
npm run build
echo 'All CI steps passed'GitHub Actions CI trigger
Defines a GitHub Actions workflow that runs tests on every push to main and every pull request targeting main.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
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 testAdd manual approval before prod deploy
Uses a GitHub Actions environment with required reviewers to enforce a manual approval gate before production.
jobs:
deploy-prod:
runs-on: ubuntu-latest
environment:
name: production # GitHub environment with required reviewers
needs: deploy-staging
steps:
- run: echo 'Deploying to production after approval'
Discussion