CI/CD stands for continuous integration and continuous delivery, or continuous deployment. It is the practice of merging code changes often and letting an automated pipeline build, test and release every change, so the software is always in a state you could deploy.
- Continuous integration (CI): developers merge small changes into the main branch at least daily. Every push triggers an automated build and test run, so a broken change is caught within minutes by the person who made it.
- Continuous delivery (CD): every change that passes the pipeline is ready to release, and releasing to production is a push-button decision.
- Continuous deployment: the same pipeline, but every passing change goes to production automatically, with no manual step. As Martin Fowler puts it, continuous deployment requires continuous delivery, but not the other way round.
Stages of a CI/CD pipeline
A typical pipeline for a web service:
- Trigger on a pull request or a merge to
main. - Build: install dependencies, compile and build a container image.
- Test: unit tests, then integration and end-to-end tests against real dependencies.
- Scan: static analysis (SAST), dependency and container vulnerability scans, secret detection, and an SBOM.
- Publish the versioned artifact to a registry.
- Deploy to staging and run smoke tests, then to production, often as a canary release or blue-green deployment.
- Verify with health checks and error-rate alerts, and roll back automatically if they fail.
Example: a GitHub Actions workflow
name: ci
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7 # pin to a full commit SHA in production
- run: npm ci
- run: npm test
- run: npm audit --audit-level=high
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production # configured with required reviewers
permissions:
contents: read
id-token: write # OIDC: short-lived cloud credentials
steps:
- uses: actions/checkout@v7
- run: ./scripts/deploy.sh
Every pull request runs the tests and a dependency audit. A merge to main runs them again, then waits for a reviewer to approve the production environment, and deploys using OIDC instead of long-lived cloud keys. The approval step makes this continuous delivery. Remove it and the same workflow becomes continuous deployment.
CI/CD tools
The three most common platforms are GitHub Actions, GitLab CI/CD and Jenkins. Others include Azure Pipelines, CircleCI and AWS CodePipeline. Teams deploying to Kubernetes often add a GitOps tool such as Argo CD or Flux, which pulls the desired state from Git into the cluster.
Common mistakes
- Slow pipelines. When CI takes 40 minutes, people batch their changes and stop integrating continuously. Cache dependencies and run tests in parallel.
- Flaky tests that everyone re-runs until they pass. Quarantine them and fix them.
- Long-lived feature branches, which defeat the point of CI. Merge small changes and hide unfinished work behind feature flags.
- Over-privileged pipelines. CI has access to code, secrets and production, so give each job only the access it needs.
Our comparison of GitHub Actions vs GitLab CI vs Jenkins covers choosing a platform and securing it.