This document describes TendSocial's CI/CD pipelines and how they're optimized for performance.
Overview
TendSocial uses GitHub Actions for continuous integration and deployment:
| Workflow | Purpose | Trigger |
|---|---|---|
backend-ci.yml | Test, build, deploy backend to Cloud Run | Push/PR to main |
frontend-ci.yml | Lint, test, build frontend | Push/PR to main |
marketing-ci.yml | Lint, test, build marketing site | Push/PR to main |
documentation-ci.yml | Build documentation | Push/PR to main |
Backend CI Pipeline
Job Structure
mermaid
flowchart LR
subgraph Parallel["Parallel Execution"]
Test[Test Job]
Build[Build Job]
end
Test & Build --> Deploy[Deploy Job]
Deploy --> CloudRun[Cloud Run]Jobs
test - Runs in parallel with build
- Starts PostgreSQL service container
- Runs
pnpm install - Generates Prisma client
- Runs database migrations
- Lints TypeScript (
tsc --noEmit) - Runs Vitest tests
build - Runs in parallel with test
- Runs
pnpm install - Generates Prisma client
- Builds TypeScript (
tsc)
- Runs
deploy - Only on
mainbranch, after test + build- Builds Docker image
- Pushes to Google Artifact Registry
- Deploys to Cloud Run with
--cpu-boost
Performance Optimizations
Caching Strategy
| Cache Type | Key Strategy | Benefit |
|---|---|---|
| pnpm store | Lockfile hash | Skip ~20s package download |
| Turbo cache | Lockfile hash | Skip unchanged package builds |
| Docker layers | GHA cache (type=gha) | Skip unchanged layers |
Key Optimizations
Parallel Jobs
testandbuildrun simultaneously- Saves ~50s vs sequential execution
Skip Puppeteer Chrome Download
yamlenv: PUPPETEER_SKIP_DOWNLOAD: 'true' PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'- Saves ~8s per workflow
- Production uses Alpine's system Chromium instead
Cloud Run CPU Boost
yamlflags: '--allow-unauthenticated --cpu-boost'- Free temporary CPU boost during cold starts
- Reduces cold start latency
Turbo Cache Key
yamlkey: turbo-backend-${{ hashFiles('pnpm-lock.yaml') }}- Uses lockfile hash instead of git SHA
- Enables cache reuse across commits
Dockerfile Optimization
The backend Dockerfile is optimized for:
- Multi-stage builds - Smaller final image
- Turbo prune - Only includes necessary monorepo packages
- System Chromium - Uses Alpine's
chromiumpackage instead of Puppeteer's bundled version - Skip browser downloads -
PUPPETEER_SKIP_DOWNLOAD=truein base stage
Troubleshooting
Cache Not Found
If you see "Cache not found" in logs:
- First run after lockfile changes will have cache miss
- Subsequent runs should hit the cache
Slow pnpm Install
Check for:
- "pnpm cache is not found" message → cache miss, expected first run
- ~7s install time = cache hit ✓
- ~25s install time = cache miss
Deploy Job Slow
The deploy job includes:
- Docker build (~2-3 min with cache hits)
- Docker push (~1 min)
- Cloud Run deploy (~1-2 min)
- GHA cache export (~2-3 min)
This is expected for production deployments.
Last Updated: December 2024
Maintainer: TendSocial Team