CI/CD Setup
Pipeline Stages
- Lint — style checks, formatting, static analysis
- Type check — mypy, TypeScript compiler
- Test — unit tests, integration tests, coverage report
- Build — compile, bundle, containerize
- Security scan — dependency audit, SAST, secrets scan
- Deploy — staging → automated tests → production (with manual gate)
Quality Gates
- All tests must pass
- Lint must be clean
- No new critical/high vulnerabilities
- Test coverage doesn't decrease
- Build succeeds
Deployment Strategies
- Blue-green: two identical environments, switch traffic
- Canary: roll out to small percentage first, monitor, then full rollout
- Feature flags: deploy code disabled, enable per-user/group
- Rollback plan: every deployment has a tested rollback
CI Config
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install -e ".[dev]"
- run: ruff check src/
- run: pytest tests/ -v