-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (123 loc) · 5.43 KB
/
Copy pathci.yml
File metadata and controls
129 lines (123 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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