Roo-Code/.github/workflows/CI.yml

110 lines
2.8 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
NODE_VERSION: 20.18.1
PNPM_VERSION: 10.8.1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build Next.js
run: npx dotenvx run -f .env.test -- pnpm build
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: roo_code_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run linter
run: pnpm lint
- name: Run type checker
run: pnpm check-types
- name: Setup database schema
run: pnpm db:test:push --force
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/roo_code_test
- name: Run unit tests
run: pnpm test
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/roo_code_test
check:
needs: [build, test]
runs-on: ubuntu-latest
steps:
- name: NO-OP
run: echo "All checks passed."
db_migrate:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [build, test]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Migrate production database
run: npx drizzle-kit migrate
env:
DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }}