name: hub check # Builds, type-checks, and tests the Hub TS package under hub/. # The Hub is the Feishu-group collaboration + agent runtime half # (spec/System implementation). This is an INTERNAL gate on the Hub's own # health, like checker-check is for the Rust half. on: push: pull_request: workflow_dispatch: jobs: hub-check: runs-on: ubuntu-latest defaults: run: working-directory: hub steps: - uses: actions/checkout@v5 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "20" cache: npm cache-dependency-path: hub/package-lock.json - name: Install dependencies run: npm ci # Prisma client must be generated before tsc can check imports from # @prisma/client. Stub DATABASE_URL so prisma generate works. - name: Generate Prisma client run: DATABASE_URL="postgresql://stub:stub@127.0.0.1:5432/stub" npx prisma generate --schema prisma/schema.prisma - name: Type-check run: npx tsc -p tsconfig.json --noEmit - name: Validate Prisma schema run: DATABASE_URL="postgresql://stub:stub@127.0.0.1:5432/stub" npx prisma validate --schema prisma/schema.prisma - name: Install cph binary run: | cd .. cargo install --path crates/cph-cli --locked - name: Run unit tests run: npx vitest run test/unit # Integration tests need PostgreSQL + cph. cph is installed above. # PostgreSQL is set up as a service container below. - name: Run integration tests (mock provider, real prisma + cph) run: | npx prisma migrate deploy --schema prisma/schema.prisma npx vitest run test/integration --exclude test/integration/real-model.test.ts env: DATABASE_URL: postgresql://paradigm:paradigm@127.0.0.1:5432/cph_hub_test # Real-model tests are skipped automatically when OPENROUTER_API_KEY is # not set. When the secret is available (e.g. on the main branch), they # run against live OpenRouter — verifying the tool-calls loop end-to-end. - name: Run real-model integration tests (optional, needs secret) run: npx vitest run test/integration/real-model.test.ts env: OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} services: postgres: image: postgres:16 env: POSTGRES_USER: paradigm POSTGRES_PASSWORD: paradigm POSTGRES_DB: cph_hub_test ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5