What is CI/CD
CI/CD (Continuous Integration / Continuous Delivery/Deployment) is an automation practice in software development.
- CI (Continuous Integration): Frequently integrates code changes into the main branch with automated builds and tests
- CD (Continuous Delivery): In addition to CI, automates deployment preparation to production
- CD (Continuous Deployment): Automatically deploys to production when tests pass
Why is CI/CD important: Manual builds, tests, and deployments are time-consuming and prone to human error.
CI/CD Pipeline Flow
flowchart LR
Source --> Build --> Test --> Deploy --> Monitor
- Source: Commit, push, create PR
- Build: Install dependencies, compile
- Test: Unit, integration, E2E tests
- Deploy: Deploy to staging and production environments
- Monitor: Health checks, error monitoring
GitHub Actions Example
name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
Deployment Strategies
| Strategy | Description |
|---|---|
| Rolling Update | Gradual replacement |
| Blue-Green | Switch between two environments |
| Canary | New version for partial traffic only |
Summary
CI/CD is an essential practice in modern software development. Through automation, you can reduce human errors and get rapid feedback.
← Back to list