Roo-Code/.github/workflows/CI.yml
Chris Estreich 5edb2f8bb6
Encrypt and store secret ENV vars in the repo with dotenvx (#114)
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Co-authored-by: John Richmond <5629+jr@users.noreply.github.com>
2025-06-26 10:54:39 -07:00

143 lines
4.1 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
NODE_VERSION: 20.19.2
PNPM_VERSION: 10.12.1
DOTENV_PRIVATE_KEY_TEST: ${{ secrets.DOTENV_PRIVATE_KEY_TEST }}
DOTENV_PRIVATE_KEY_DEVELOPMENT: ${{ secrets.DOTENV_PRIVATE_KEY_DEVELOPMENT }}
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 workspaces
run: pnpm build
env:
DOTENV_PRIVATE_KEY_PRODUCTION: ${{ secrets.DOTENV_PRIVATE_KEY_PRODUCTION }}
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
clickhouse:
image: clickhouse/clickhouse-server
env:
CLICKHOUSE_DB: default
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: password
ports:
- 8123:8123
- 9000:9000
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1"
--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 --filter @roo-code-cloud/db db:test:push --force
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
- name: Setup ClickHouse schema
run: |
# Wait for ClickHouse to be ready
curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:8123/ping
# Install clickhouse-client
sudo apt-get update
sudo apt-get install -y clickhouse-client
# Execute the schema file directly using clickhouse-client
clickhouse-client --host localhost --port 9000 --password password --multiquery < .docker/scripts/clickhouse/001-create-tables.sql
- name: Run unit tests
run: pnpm test
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
CLICKHOUSE_URL: http://localhost:8123/default
CLICKHOUSE_PASSWORD: password
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: pnpm db:production:migrate
working-directory: packages/db
env:
DOTENV_PRIVATE_KEY_PRODUCTION: ${{ secrets.DOTENV_PRIVATE_KEY_PRODUCTION }}