ADR-0013 切片 3 第 15 项:修订门的 CTA 不再说「从当前检查点继续执行」。workspace_view 里两类审批门此前… #29
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| web: | |
| name: Web typecheck / lint / build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| # 按 ADR-0002:统一在仓库根安装。apps/web 的 tsconfig extends | |
| # @openmathmodel/config(workspace 包),子目录单独安装解析不到它。 | |
| - run: npm ci | |
| - run: npm run check --workspace @openmathmodel/web | |
| - run: npm run build --workspace @openmathmodel/web | |
| python: | |
| name: Python syntax + contracts gate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: python -m compileall -q datasets/recipes packages/contracts | |
| - name: Contracts gate (self-check + compatibility + generated models, activates once contracts land) | |
| run: | | |
| if [ -f packages/contracts/validate.py ]; then | |
| pip install -r packages/contracts/requirements-dev.txt | |
| python packages/contracts/validate.py | |
| python packages/contracts/check_compat.py | |
| python packages/contracts/scripts/generate_python.py --check | |
| python packages/contracts/scripts/generate_python.py --verify | |
| else | |
| echo "contracts not present on this ref; skipped" | |
| fi | |
| - name: API tests (activates once backend/api lands) | |
| run: | | |
| if [ -f backend/api/pyproject.toml ]; then | |
| # backend/api 依赖 omm-agent-skills / omm-agent-tools(真实技能节点与 | |
| # 实验沙箱),skills 又依赖 omm-agent-harness(Loop 引擎),它们只存在 | |
| # 于本仓库,必须与 contracts/core 一样以可编辑方式一并安装,否则 pip | |
| # 会去 PyPI 找。 | |
| pip install -e packages/contracts -e agents/core -e agents/harness -e agents/skills -e agents/tools -e "backend/api[dev]" | |
| python -m pytest backend/api/tests -q | |
| python packages/contracts/scripts/export_openapi.py --check | |
| else | |
| echo "backend/api not present on this ref; skipped" | |
| fi | |
| - name: Agent runtime tests (activates once agents/core lands) | |
| run: | | |
| if [ -f agents/core/pyproject.toml ]; then | |
| pip install -e agents/core -e agents/harness -e agents/tools -e agents/skills -e backend/worker -e agents/evals pytest | |
| for pkg in agents/core agents/harness agents/tools agents/skills backend/worker agents/evals; do | |
| (cd "$pkg" && python -m pytest tests -q) | |
| done | |
| else | |
| echo "agent runtime not present on this ref; skipped" | |
| fi | |
| api-postgres: | |
| name: API tests on PostgreSQL | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| # 与 infra/docker/compose.dev.yaml 同镜像同版本:CI 验证的就是部署要用的底座 | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_USER: openmathmodel | |
| POSTGRES_PASSWORD: openmathmodel-dev | |
| POSTGRES_DB: openmathmodel | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U openmathmodel -d openmathmodel" | |
| --health-interval 5s | |
| --health-timeout 3s | |
| --health-retries 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| # 与 python job 相同的可编辑安装(backend/api 依赖本仓库的 contracts/core/harness/skills/tools) | |
| - name: Install backend/api with workspace deps | |
| run: pip install -e packages/contracts -e agents/core -e agents/harness -e agents/skills -e agents/tools -e "backend/api[dev]" | |
| # 迁移验证用独立数据库:alembic_version 等痕迹不进测试库,两条验证互不干扰 | |
| - name: Alembic upgrade head on real PostgreSQL | |
| working-directory: backend/api | |
| env: | |
| OMM_DATABASE_URL: postgresql+psycopg://openmathmodel:openmathmodel-dev@127.0.0.1:5432/omm_migrations | |
| run: | | |
| python -c "import psycopg; psycopg.connect('postgresql://openmathmodel:openmathmodel-dev@127.0.0.1:5432/postgres', autocommit=True).execute('CREATE DATABASE omm_migrations')" | |
| python -m alembic upgrade head | |
| # conftest 的 OMM_TEST_DATABASE_URL 覆盖:同一套件对真库实跑(每用例 drop_all 隔离)。 | |
| # 此前 PG 兼容只靠人工验证记录,这个 job 把它变成每次提交都执行的机器事实。 | |
| - name: Full API test suite on real PostgreSQL | |
| env: | |
| OMM_TEST_DATABASE_URL: postgresql+psycopg://openmathmodel:openmathmodel-dev@127.0.0.1:5432/openmathmodel | |
| run: python -m pytest backend/api/tests -q | |
| contracts-ts: | |
| name: Contracts generated TS types | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Generated types up to date (activates once workspaces land) | |
| run: | | |
| if [ -f package-lock.json ] && [ -f packages/contracts/package.json ]; then | |
| npm ci | |
| npm run check --workspace @openmathmodel/contracts | |
| else | |
| echo "contracts workspace not present on this ref; skipped" | |
| fi |