Add configuration for BMad, Claude, OpenCode, and other AI agent tools and workflows.
2.7 KiB
2.7 KiB
GitHub Actions
Complete setup guide for Turborepo with GitHub Actions.
Basic Workflow Structure
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build and Test
run: turbo run build test lint
Package Manager Setup
pnpm
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
Yarn
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- run: yarn install --frozen-lockfile
Bun
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install --frozen-lockfile
Remote Cache Setup
1. Create Vercel Access Token
- Go to Vercel Dashboard
- Create a new token with appropriate scope
- Copy the token value
2. Add Secrets and Variables
In your GitHub repository settings:
Secrets (Settings > Secrets and variables > Actions > Secrets):
TURBO_TOKEN: Your Vercel access token
Variables (Settings > Secrets and variables > Actions > Variables):
TURBO_TEAM: Your Vercel team slug
3. Add to Workflow
jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
Alternative: actions/cache
If you can't use remote cache, cache Turborepo's local cache directory:
- uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ hashFiles('**/turbo.json', '**/package-lock.json') }}
restore-keys: |
turbo-${{ runner.os }}-
Note: This is less effective than remote cache since it's per-branch.
Complete Example
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: turbo run build --affected
- name: Test
run: turbo run test --affected
- name: Lint
run: turbo run lint --affected