Same hygiene fix as git-sync (review #2), applied to packages/mcp which had the identical pre-existing problem: committed build/ (20 files) + node_modules (28, pnpm symlinks with a baked /home/claude store path). - git rm --cached packages/mcp/{build,node_modules}. - .gitignore: add packages/mcp/build/ (packages/*/node_modules/ already covers it). - Build where consumed: apps/server `pretest` and the CI Test workflow now build @docmost/mcp too. The Dockerfile builder already runs `pnpm build` (nx builds mcp) and already COPYs packages/mcp/build into the runtime image. Verified: wiped build/, rebuilt via `pnpm --filter @docmost/mcp build`; the mcp server suites (96 tests) pass against the freshly-built, non-committed output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
name: Test
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
# Real Postgres + Redis so the server integration suite (`*.int-spec.ts`,
|
|
# behind `pnpm --filter server test:int`) runs in CI (red-team finding #7).
|
|
# Without it, cost-cap / FK-cascade / jsonb-round-trip / real-apply tests
|
|
# only ran locally, so regressions in those paths stayed green in CI.
|
|
# Postgres uses the pgvector image because migrations create vector columns
|
|
# and global-setup runs `CREATE EXTENSION vector`. Credentials/db match the
|
|
# defaults in apps/server/test/integration/db.ts + global-setup.ts
|
|
# (docmost / docmost_dev_pw, maintenance db `docmost`, redis on 6379), so no
|
|
# TEST_*_URL overrides are needed.
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg18
|
|
env:
|
|
POSTGRES_USER: docmost
|
|
POSTGRES_PASSWORD: docmost_dev_pw
|
|
POSTGRES_DB: docmost
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U docmost"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# Required for the client suite, which resolves @docmost/editor-ext via its
|
|
# dist build (the server suite also rebuilds it through its own pretest).
|
|
- name: Build editor-ext
|
|
run: pnpm --filter @docmost/editor-ext build
|
|
|
|
# git-sync and mcp are no longer committed in built form (build/ is
|
|
# gitignored), so CI must compile them: the server resolves both via their
|
|
# built build/index.js. The server pretest also builds them, but building
|
|
# here keeps it explicit and independent of pnpm lifecycle ordering.
|
|
- name: Build git-sync and mcp
|
|
run: pnpm --filter @docmost/git-sync build && pnpm --filter @docmost/mcp build
|
|
|
|
- name: Run unit tests
|
|
run: pnpm -r test
|
|
|
|
# Integration suite against the real Postgres/Redis services above. Runs
|
|
# the FK-cascade, cost-cap, jsonb-round-trip and real-apply specs that the
|
|
# unit run (mocks only) cannot cover. global-setup drops/recreates the
|
|
# isolated `docmost_test` DB and migrates it to latest.
|
|
- name: Run server integration tests
|
|
run: pnpm --filter server test:int
|