refactor(provision): cross-relations via provisionBlueprint() (drop raw SQL) #95
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: Integration Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PGPM_VERSION: '4.7.4' | |
| jobs: | |
| pgpm-deploy: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout agentic-db | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Create test database and bootstrap users | |
| run: | | |
| eval "$(pgpm env)" | |
| createdb agentic_db_test | |
| pgpm admin-users bootstrap --database agentic_db_test --yes | |
| pgpm admin-users add --database agentic_db_test --test --yes | |
| - name: Install extensions | |
| run: | | |
| eval "$(pgpm env)" | |
| psql -d agentic_db_test -c "CREATE EXTENSION IF NOT EXISTS pg_textsearch;" | |
| - name: Deploy agentic-db package | |
| run: | | |
| eval "$(pgpm env)" | |
| cd packages/agentic-db | |
| pgpm deploy --package agentic-db --database agentic_db_test --yes | |
| - name: Deploy agentic-db-services package | |
| run: | | |
| eval "$(pgpm env)" | |
| cd packages/agentic-db-services | |
| pgpm deploy --package agentic-db-services --database agentic_db_test --yes | |
| - name: Verify deployment | |
| run: | | |
| eval "$(pgpm env)" | |
| echo "=== Schemas ===" | |
| psql -d agentic_db_test -tAc " | |
| SELECT schema_name FROM information_schema.schemata | |
| WHERE schema_name LIKE 'agentic_db_%' | |
| ORDER BY schema_name; | |
| " | |
| echo "=== Table count ===" | |
| TABLE_COUNT=$(psql -d agentic_db_test -tAc " | |
| SELECT count(*) FROM information_schema.tables | |
| WHERE table_schema LIKE 'agentic_db_%'; | |
| ") | |
| echo "Tables: ${TABLE_COUNT}" | |
| if [ "${TABLE_COUNT}" -lt 1 ]; then | |
| echo "ERROR: No tables found!" | |
| exit 1 | |
| fi | |
| echo "=== BM25 indexes ===" | |
| BM25_COUNT=$(psql -d agentic_db_test -tAc " | |
| SELECT count(*) FROM pg_indexes | |
| WHERE indexdef LIKE '%USING bm25%'; | |
| ") | |
| echo "BM25 indexes: ${BM25_COUNT}" | |
| echo "Deployment verified!" | |
| orm-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Bootstrap pgpm admin users | |
| run: | | |
| eval "$(pgpm env)" | |
| pgpm admin-users bootstrap --yes | |
| pgpm admin-users add --test --yes | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.22.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Debug dependency tree | |
| run: | | |
| echo "=== pnpm version ===" | |
| pnpm --version | |
| echo "=== graphql versions ===" | |
| pnpm list graphql --depth=10 2>/dev/null | grep graphql || true | |
| echo "=== grafast versions ===" | |
| pnpm list grafast --depth=10 2>/dev/null | grep grafast || true | |
| echo "=== Check for duplicate graphql in node_modules ===" | |
| find node_modules -name "package.json" -path "*/graphql/package.json" -exec sh -c 'echo "$(dirname {}): $(node -e "console.log(require(\"$(dirname {})/package.json\").version)")"' \; 2>/dev/null || true | |
| echo "=== Check grafast singleton ===" | |
| node -e " | |
| const g1 = require('grafast'); | |
| const g2 = require('graphile-test/node_modules/grafast' + '/package.json').version || 'N/A'; | |
| console.log('Root grafast:', require('grafast/package.json').version); | |
| console.log('graphile-test grafast:', g2); | |
| " 2>/dev/null || echo "grafast check failed" | |
| - name: Run ORM tests | |
| run: | | |
| cd packages/integration-tests | |
| pnpm test:orm | |
| embedding-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Bootstrap pgpm admin users | |
| run: | | |
| eval "$(pgpm env)" | |
| pgpm admin-users bootstrap --yes | |
| pgpm admin-users add --test --yes | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.22.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run embedding tests | |
| run: | | |
| cd packages/integration-tests | |
| pnpm test:embeddings | |
| embedding-pipeline: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| OLLAMA_URL: http://localhost:11434 | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| ollama: | |
| image: ollama/ollama:latest | |
| ports: | |
| - 11434:11434 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Bootstrap pgpm admin users | |
| run: | | |
| eval "$(pgpm env)" | |
| pgpm admin-users bootstrap --yes | |
| pgpm admin-users add --test --yes | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.22.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Wait for Ollama and pull model | |
| run: | | |
| echo "Waiting for Ollama to be ready..." | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then | |
| echo "Ollama is ready!" | |
| break | |
| fi | |
| echo "Waiting for Ollama... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Pulling nomic-embed-text model..." | |
| curl -sf http://localhost:11434/api/pull -d '{"name": "nomic-embed-text"}' | |
| echo "" | |
| echo "Model pulled successfully." | |
| - name: Run embedding pipeline tests | |
| run: | | |
| cd packages/integration-tests | |
| pnpm test:embedding-pipeline | |
| rag-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| OLLAMA_URL: http://localhost:11434 | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| ollama: | |
| image: ollama/ollama:latest | |
| ports: | |
| - 11434:11434 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Bootstrap pgpm admin users | |
| run: | | |
| eval "$(pgpm env)" | |
| pgpm admin-users bootstrap --yes | |
| pgpm admin-users add --test --yes | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.22.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build SDK | |
| run: pnpm --filter @agentic-db/sdk run build | |
| - name: Wait for Ollama and pull model | |
| run: | | |
| echo "Waiting for Ollama to be ready..." | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then | |
| echo "Ollama is ready!" | |
| break | |
| fi | |
| echo "Waiting for Ollama... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Pulling nomic-embed-text model..." | |
| curl -sf http://localhost:11434/api/pull -d '{"name": "nomic-embed-text"}' | |
| echo "" | |
| echo "Model pulled successfully." | |
| - name: Run RAG tests | |
| run: | | |
| cd packages/agentic-db | |
| pnpm test -- --forceExit --detectOpenHandles __tests__/rag.test.ts __tests__/rag-unified-search.test.ts __tests__/cli-search-integration.test.ts | |
| cli-e2e-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGPASSWORD: password | |
| OLLAMA_URL: http://localhost:11434 | |
| services: | |
| pg_db: | |
| image: docker.io/constructiveio/postgres-plus:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| ollama: | |
| image: ollama/ollama:latest | |
| ports: | |
| - 11434:11434 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache pgpm CLI | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: pgpm-${{ runner.os }}-${{ env.PGPM_VERSION }} | |
| - name: Install pgpm CLI globally | |
| run: npm install -g pgpm@${{ env.PGPM_VERSION }} | |
| - name: Bootstrap pgpm admin users | |
| run: | | |
| eval "$(pgpm env)" | |
| pgpm admin-users bootstrap --yes | |
| pgpm admin-users add --test --yes | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.22.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build SDK | |
| run: pnpm --filter @agentic-db/sdk run build | |
| - name: Wait for Ollama and pull model | |
| run: | | |
| echo "Waiting for Ollama to be ready..." | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then | |
| echo "Ollama is ready!" | |
| break | |
| fi | |
| echo "Waiting for Ollama... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Pulling nomic-embed-text model..." | |
| curl -sf http://localhost:11434/api/pull -d '{"name": "nomic-embed-text"}' | |
| echo "" | |
| echo "Model pulled successfully." | |
| - name: Run CLI E2E tests | |
| run: | | |
| cd packages/cli-e2e-tests | |
| pnpm test:cli |