This document describes the custom CI/CD pipeline for the TiQology AI Chatbot project. The pipeline is designed to ensure code quality, security, and reliable deployments across multiple environments.
┌─────────────────────────────────────────────────────────────────┐
│ CI/CD Pipeline Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Code Push/PR │
│ ↓ │
│ ┌──────────┐ │
│ │ Setup │ → Cache Dependencies & Environment │
│ └────┬─────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ Parallel Quality & Security Checks │ │
│ ├──────────┬──────────┬────────────────┤ │
│ │ Lint │ Type │ Security │ │
│ │ Check │ Check │ Scan │ │
│ └────┬─────┴────┬─────┴────┬───────────┘ │
│ └──────────┴──────────┘ │
│ ↓ │
│ ┌──────────────────────────┐ │
│ │ Parallel Test Execution │ │
│ ├──────────┬───────────────┤ │
│ │ Unit │ E2E │ │
│ │ Tests │ Tests │ │
│ └────┬─────┴────┬──────────┘ │
│ └──────────┘ │
│ ↓ │
│ ┌─────────────┐ │
│ │ Build │ → Create Production Build │
│ └──────┬──────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ Environment Deployments │ │
│ ├──────────┬──────────┬────────────────┤ │
│ │ Dev │ Staging │ Production │ │
│ │ (develop)│ (main) │ (main) │ │
│ └──────────┴──────────┴────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ Post-Deployment Tasks │ │
│ ├──────────┬──────────┬────────────────┤ │
│ │ DB │Lighthouse│ Health │ │
│ │Migration │ Audit │ Checks │ │
│ └──────────┴──────────┴────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
The main pipeline includes the following stages:
- Purpose: Environment preparation and dependency caching
- Actions:
- Checkout code with full history
- Generate cache keys for dependencies
- Install and cache Node.js and pnpm
- Install project dependencies
- Caching Strategy: Uses hash of
pnpm-lock.yamlfor cache invalidation
- Purpose: Ensure code quality and standards
- Checks:
- ESLint/Biome linting
- TypeScript type checking
- Code formatting validation
- Parallel Execution: Runs independently for faster feedback
-
Unit Tests:
- Runs Jest test suite
- Uses PostgreSQL test database
- Generates coverage reports
- Uploads test artifacts
-
E2E Tests:
- Playwright browser tests
- Tests critical user flows
- Generates visual regression reports
- Can be skipped with workflow dispatch input
- Purpose: Create production-ready build
- Actions:
- Build Next.js application
- Analyze bundle size
- Upload build artifacts for deployment
- Memory: Allocates 6GB for large builds
- Vulnerability Scanning:
- Trivy filesystem scanner
- SARIF report upload to GitHub Security
- Dependency audit with pnpm
- Outdated package detection
- Purpose: Create containerized version
- Actions:
- Build Docker image
- Tag with commit SHA
- Use GitHub Actions cache for layers
- When: Only on
mainordevelopbranches
- Trigger: Push to
developbranch - URL: https://dev.tiqology.vercel.app
- Features:
- Automatic deployment
- PR comment with preview URL
- Quick iteration testing
- Trigger: Push to
mainbranch - URL: https://staging.tiqology.vercel.app
- Features:
- Pre-production testing
- E2E test execution
- Performance validation
- Trigger: After successful staging deployment
- URL: https://tiqology.vercel.app
- Features:
- Manual approval (environment protection)
- Automated tagging
- GitHub release creation
- Cloudflare DNS configuration
- Health checks
- Rollback capability
- When: After production deployment
- Actions:
- Run Drizzle migrations
- Verify schema integrity
- Generate migration summary
- URLs Tested:
- Homepage
- Login page
- Register page
- Metrics: Performance, Accessibility, Best Practices, SEO
- Endpoints:
/api/health - Validation: HTTP 200 status
- Alerts: Failure notifications
- Trigger: Pull requests
- Purpose: Deploy PR changes to preview URL
- Features:
- Automatic comment with preview link
- Lighthouse audit on preview
- Quick links to key pages
- Schedule: Weekly (Monday 9 AM UTC)
- Actions:
- Check for outdated packages
- Update to latest versions
- Run tests
- Create automated PR
- Schedule: Daily (2 AM UTC)
- Components:
- CodeQL analysis
- Dependency review
- Secret scanning (TruffleHog)
- Code coverage tracking
- License compliance
Configure these secrets in your GitHub repository settings:
VERCEL_TOKEN # Vercel authentication token
VERCEL_ORG_ID # Vercel organization ID
VERCEL_PROJECT_ID # Vercel project ID
PRODUCTION_DATABASE_URL # PostgreSQL connection string for production
CLOUDFLARE_ZONE_ID # Cloudflare zone identifier
CLOUDFLARE_API_TOKEN # Cloudflare API token
DOCKER_USERNAME # Docker Hub username
DOCKER_PASSWORD # Docker Hub password or token
The main pipeline can be manually triggered with:
Environment: development | staging | production
Skip Tests: true | false (default: false)Usage:
- Go to Actions tab in GitHub
- Select "TiQology Custom CI/CD Pipeline"
- Click "Run workflow"
- Choose branch and options
- Click "Run workflow" button
- Reviewers: Require approval from designated team members
- Wait Timer: Optional delay before deployment
- Branch Protection: Only
mainbranch can deploy
- Auto-deployment: Enabled for
mainbranch - Testing: E2E tests run automatically
All deployments create the following artifacts:
-
Build Output (7 days retention)
.nextdirectorypublicassets
-
Test Results (30 days retention)
- Jest coverage reports
- Playwright test results
- E2E screenshots and videos
-
Performance Reports
- Lighthouse scores
- Bundle size analysis
- Triggered on production deployment failure
- Reverts to last known good deployment
- Notifications sent to team
- Navigate to Vercel dashboard
- Select previous deployment
- Click "Promote to Production"
- Verify health checks
Or use Git:
git revert <commit-hash>
git push origin main- GitHub commit status
- Deployment summaries
- Performance reports
- Failed build alerts
- Test failure reports
- Security vulnerability warnings
- Health check failures
- Parallel Job Execution: Quality checks, tests, and scans run simultaneously
- Smart Caching: Dependencies cached based on lockfile hash
- Artifact Reuse: Build artifacts shared across deployment jobs
- Conditional Execution: Skip unnecessary jobs based on branch/triggers
- Incremental Builds: Only rebuild changed components
-
Before Pushing:
pnpm lint # Check code style pnpm test # Run tests locally pnpm build # Ensure build succeeds
-
Feature Branches:
- Create from
develop - Name format:
feature/description - Open PR to
developfor review
- Create from
-
Hotfix Branches:
- Create from
main - Name format:
fix/description - Open PR to
mainwith urgency label
- Create from
- Check preview deployment before approving
- Review test results and coverage
- Verify no security vulnerabilities
- Ensure performance metrics are acceptable
Issue: Out of memory error
Solution: Increase NODE_OPTIONS memory allocation
Already set to --max-old-space-size=6144
Issue: Dependency installation fails
Solution: Clear cache and retry
- Delete cache in GitHub Actions settings
- Re-run workflow
Issue: E2E tests timing out
Solution: Increase Playwright timeout
Edit playwright.config.ts timeout settings
Issue: Database connection errors
Solution: Verify POSTGRES_URL secret
Check database is accessible from GitHub runners
Issue: Vercel deployment fails
Solution: Check Vercel token and project settings
Verify VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID
Issue: Health check fails
Solution: Wait longer for deployment to warm up
Check application logs in Vercel dashboard
Track these metrics for pipeline health:
- Build Time: Target < 10 minutes
- Test Success Rate: Target > 95%
- Deployment Frequency: Target 2-3x per day
- Mean Time to Recovery: Target < 1 hour
- Lighthouse Performance Score: Target > 90
Planned improvements:
- ✅ Automated dependency updates
- ✅ Advanced security scanning
- ✅ Performance monitoring
- 🔄 Slack/Discord notifications
- 🔄 Automated rollback on errors
- 🔄 Blue-green deployments
- 🔄 Canary releases
- 🔄 A/B testing infrastructure
For pipeline issues or questions:
- Create an issue in the repository
- Tag with
ci-cdlabel - Include workflow run URL
- Provide error logs
Last Updated: December 22, 2025 Version: 2.0 Maintained By: TiQology DevOps Team