CAIRL CI/CD Pipeline
Overview
┌─────────────────────────────────────────────────────────┐
│ LOCAL: Feature Branch │
│ • Docker PostgreSQL (isolated) │
│ • Unit tests before commit │
└────────────────────────┬────────────────────────────────┘
│ PR to develop
▼
┌─────────────────────────────────────────────────────────┐
│ CI: PR Quality Gate │
│ • Lint │
│ • TypeScript check │
│ • Unit tests │
└────────────────────────┬────────────────────────────────┘
│ Merge
▼
┌─────────────────────────────────────────────────────────┐
│ CI: develop branch │
│ • Integration tests (cairl-dev DB) │
│ • Auto-rebase open PRs │
│ • Auto-create PR to staging │
└────────────────────────┬────────────────────────────────┘
│ Merge
▼
┌─────────────────────────────────────────────────────────┐
│ CI: staging branch │
│ • Deploy to staging.cairl.app │
│ • E2E tests (Playwright) │
│ • Human UAT │
└────────────────────────┬────────────────────────────────┘
│ Approve + Merge
▼
┌─────────────────────────────────────────────────────────┐
│ PRODUCTION: main branch │
│ • Deploy to cairl.app │
│ • Smoke tests │
└─────────────────────────────────────────────────────────┘
Workflow Files
| File |
Trigger |
Purpose |
.github/workflows/pr-quality.yml |
PR to develop |
Quality gate |
.github/workflows/auto-rebase.yml |
Push to develop |
Keep PRs fresh |
.github/workflows/integration-tests.yml |
Push to develop |
Test + promote |
.github/workflows/e2e-tests.yml |
Push to staging |
E2E + notify |
Required Secrets
| Secret |
Where to Set |
Purpose |
DEV_DATABASE_URL |
GitHub Secrets |
Integration tests |
Debugging Failed Workflows
PR Quality Failed
- Click "Details" on failed check
- Look at which step failed (lint/types/tests)
- Fix locally, push again
Integration Tests Failed
- Check GitHub Actions log
- Look for database connection errors or test failures
- May need to run
db:push against cairl-dev
E2E Tests Failed
- Download
playwright-report artifact
- Open
index.html to see screenshots
- Check if Vercel deployment succeeded
Auto-Rebase Failed
- PR has merge conflicts
- Manually rebase:
git fetch origin && git rebase origin/develop
- Resolve conflicts, force push
Environment Matrix
| Branch |
Database |
URL |
Tests |
| feature/* |
Docker local |
localhost:3000 |
Unit (local) |
| develop |
cairl-dev |
dev.cairl.app |
Integration (CI) |
| staging |
cairl-staging |
staging.cairl.app |
E2E (CI) + UAT |
| main |
cairl-production |
cairl.app |
Smoke |
Local Development Commands
# Database
npm run db:local:start # Start Docker PostgreSQL
npm run db:local:stop # Stop Docker PostgreSQL
npm run db:local:reset # Nuke and recreate local DB
npm run db:push # Apply schema to current DATABASE_URL
# Testing
npm run test:unit # Unit tests (mocked DB)
npm run test:integration # Integration tests (real DB)
npm run test:e2e # E2E browser tests
# Quality
npm run lint # ESLint
npm run type-check # TypeScript
npm run format # Prettier