Skip to content

Guide 18: Setting Up CI

This guide documents setting up GitHub Actions for continuous integration with proper Turborepo task dependencies and Vercel deployment.

Added a GitHub Actions CI workflow that runs type checking, linting, formatting, and tests on every push to main and pull request.

Created .github/workflows/ci.yml with two parallel jobs:

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run check-types
- run: bun run lint
- run: bun run format:check
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run test

The key to making CI work was configuring turbo.json correctly:

{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
},
"check-types": {
"dependsOn": ["^check-types", "^transit"]
},
"test": {
"dependsOn": ["transit"]
},
"transit": {
"dependsOn": ["^transit"]
}
}
}

The vitest-config package exports TypeScript that needs to be compiled before other packages can use it. The transit task runs tsc to build these dependencies.

  • check-types depends on ^transit so config packages are built first
  • test depends on transit so vitest can load the compiled config
  • build outputs include dist/** for Astro builds (needed for Vercel caching)

Added ignores for auto-generated files that conflict with formatting:

**/convex/_generated
**/convex/**/_generated
**/next-env.d.ts

Next.js regenerates next-env.d.ts with semicolons, which conflicts with our Prettier config (no semicolons).

The dist/** in turbo.json build outputs is critical for Vercel deployment:

  • Vercel uses Turborepo caching
  • When cache hits, outputs must be restored correctly
  • Without dist/**, the Astro docs build output wasn’t restored
ActionFiles
Created.github/workflows/ci.yml
Modifiedturbo.json
Modified.prettierignore
Createdapps/docs/vercel.json
Modifiedpackages/vitest-config/*
Terminal window
# Run all CI checks locally
bun run check-types
bun run lint
bun run format:check
bun run test

When CI fails:

  1. Type errors: Check if transit task ran first (turbo check-types handles this)
  2. Format errors: Run bun format to fix, check .prettierignore for generated files
  3. Test errors: Ensure vitest-config is built (turbo test handles this)
  4. Vercel build fails: Check turbo.json outputs include the build directory