iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Intro

CI/CD is the practice of automating build, test, and deploy so changes flow from commit to production safely and quickly.

CI/CD — what it is

EXAMPLE
# ===== The values =====
# CI  Continuous Integration: every commit is built + tested automatically
# CD  Continuous Delivery: every green build produces a deployable artifact
# CD  Continuous Deployment: every green build deploys to production automatically

# ===== Why it matters =====
# - Fast feedback: minutes from commit to 'pass/fail'
# - Reproducible deploys: artifact in, deploy out
# - Smaller releases = smaller blast radius = faster rollbacks
# - The pipeline becomes the documented release process

# ===== The standard stages =====
# checkout -> install -> lint -> typecheck -> test -> build -> security-scan -> deploy

# ===== GitHub Actions example =====
name: ci
on: [push, pull_request]
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: 'npm' }
      - run: npm ci
      - run: npm run lint
      - run: npm test -- --coverage
      - run: npm run build

# ===== Tools landscape =====
# Hosted:   GitHub Actions, GitLab CI, Bitbucket Pipelines, Azure DevOps,
#           CircleCI, Travis (legacy), Buildkite (hybrid), Vercel/Netlify (frontend)
# Self-host: Jenkins (classic), Drone, Concourse, Argo CD/Workflows, Buildkite agents
# Promotion: Spinnaker, Argo CD, Flux, GitLab Environments

# ===== Quality gates =====
# - Required status checks on the main branch
# - Branch protection: no direct push to main
# - Merge queue / serialised merging when traffic is high
# - Code owners required on sensitive paths

# ===== When CI/CD wins =====
# - Every project. Yes, even solo / weekend ones.
# - Larger when test coverage exists, when artifacts are reproducible, when rollback is rehearsed

# ===== When CI/CD hurts =====
# - Pipelines longer than ~20 min start to feel like batch jobs
# - Without ownership, pipelines decay and gates become noise

# ===== Patterns to internalise =====
# - One artifact promoted through environments (never rebuild for prod)
# - Cache deps; don't cache build outputs
# - Matrix builds for cross-version coverage
# - Manual gates only where automation hasn't reached yet

# ===== Pitfalls =====
# - 'green tests' confused with 'safe to deploy' -> add smoke + canary
# - Slow flaky tests pushed into CI -> people batch commits to avoid the wait
# - Secrets in workflow files -> use the platform secret store
# - Forgetting deployment audit trail (who deployed what when)

Why it matters

CI/CD is the operating system of modern delivery. Build once, promote through environments, automate the safety net, and keep pipelines fast. The discipline pays back every day — fewer surprise deploys, faster recoveries, and a record of what shipped when.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
# CI = Continuous Integration: every commit is built + tested automatically.
# CD = Continuous Delivery (deploy-on-demand) or Deployment (auto-deploy).
Try it Yourself »

Test yourself

Q1. CI stands for…
Q2. CD typically means…
Q3. A pipeline is triggered by…

Discussion

Loading…