feat(cli): add MCP server for coding agent integration #121
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'packages/**' | |
| - 'bun.lockb' | |
| - 'tsconfig*.json' | |
| - '.github/workflows/ci.yml' | |
| pull_request: | |
| branches: [main, master] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'packages/**' | |
| - 'bun.lockb' | |
| - 'tsconfig*.json' | |
| - '.github/workflows/ci.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| ports: | |
| - 15432:5432 | |
| env: | |
| POSTGRES_USER: noorm_test | |
| POSTGRES_PASSWORD: noorm_test | |
| POSTGRES_DB: noorm_test | |
| options: >- | |
| --health-cmd "pg_isready -U noorm_test" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| mysql: | |
| image: mysql:8.0 | |
| ports: | |
| - 13306:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: noorm_test | |
| MYSQL_DATABASE: noorm_test | |
| MYSQL_USER: noorm_test | |
| MYSQL_PASSWORD: noorm_test | |
| options: >- | |
| --health-cmd "mysqladmin ping -h localhost" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| mssql: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| ports: | |
| - 11433:1433 | |
| env: | |
| ACCEPT_EULA: 'Y' | |
| SA_PASSWORD: 'NoOrm_Test123!' | |
| MSSQL_PID: Developer | |
| options: >- | |
| --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'NoOrm_Test123!' -C -Q 'SELECT 1' || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| --health-start-period 30s | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Create MSSQL test databases | |
| run: | | |
| docker exec $(docker ps -q --filter "ancestor=mcr.microsoft.com/mssql/server:2022-latest") \ | |
| /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'NoOrm_Test123!' -C \ | |
| -Q "IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'noorm_test') CREATE DATABASE [noorm_test]; IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'noorm_test_dest') CREATE DATABASE [noorm_test_dest];" | |
| - run: bun install --frozen-lockfile | |
| - run: bun run lint | |
| - run: bun run typecheck | |
| - run: bun run build | |
| # Split test runs to prevent cross-contamination from mock.module | |
| # Tests using mock.module run separately from those that don't | |
| - name: Run core tests | |
| env: | |
| CI: 'false' | |
| FORCE_COLOR: 'true' | |
| run: bun test --serial tests/utils tests/core tests/sdk | |
| - name: Run CLI tests | |
| env: | |
| CI: 'false' | |
| FORCE_COLOR: 'true' | |
| run: bun test --serial tests/cli | |
| - name: Run integration tests | |
| env: | |
| CI: 'false' | |
| FORCE_COLOR: 'true' | |
| run: bun test --serial tests/integration | |
| cli-e2e: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - run: bun run build | |
| # Test: Valid SQL should build successfully (exit 0) | |
| - name: Test valid SQL build | |
| env: | |
| NOORM_CONNECTION_DIALECT: sqlite | |
| NOORM_CONNECTION_DATABASE: ./tmp/ci-success.db | |
| NOORM_PATHS_SQL: ./tests/fixtures/ci/success/sql | |
| NOORM_IDENTITY: ci | |
| run: | | |
| mkdir -p ./tmp | |
| node dist/cli/index.js -H run build | |
| echo "Success: Valid SQL built successfully" | |
| # Test: Invalid SQL should fail (exit 2) | |
| - name: Test invalid SQL build (expect failure) | |
| env: | |
| NOORM_CONNECTION_DIALECT: sqlite | |
| NOORM_CONNECTION_DATABASE: ./tmp/ci-failure.db | |
| NOORM_PATHS_SQL: ./tests/fixtures/ci/failure/sql | |
| NOORM_IDENTITY: ci | |
| run: | | |
| mkdir -p ./tmp | |
| set +e | |
| node dist/cli/index.js -H run build | |
| EXIT_CODE=$? | |
| set -e | |
| if [ $EXIT_CODE -eq 2 ]; then | |
| echo "Success: CLI correctly returned exit code 2 for failed build" | |
| else | |
| echo "Failure: Expected exit code 2, got $EXIT_CODE" | |
| exit 1 | |
| fi |