-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (134 loc) · 5.79 KB
/
Copy pathci.yml
File metadata and controls
140 lines (134 loc) · 5.79 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
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
# 项目要求提交按切片依次推送。保留每个提交的完整检查结果,避免后一
# 次推送把前一轮标成 cancelled,导致提交列表出现并非测试失败的红叉。
cancel-in-progress: false
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"
- name: Compile shipped Python sources
run: |
python -m compileall -q \
datasets/recipes \
packages/contracts \
agents/core/src \
agents/evals/src \
agents/harness/src \
agents/skills/src \
agents/tools/src \
backend/api/omm_api \
backend/worker/src
- 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 package + OpenAPI gate (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 -c "import omm_api; from omm_api.main import create_app; assert callable(create_app)"
python packages/contracts/scripts/export_openapi.py --check
else
echo "backend/api not present on this ref; skipped"
fi
- name: Agent package import gate (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
python -c "import omm_agent_core, omm_agent_harness, omm_agent_tools, omm_agent_skills, omm_worker, omm_agent_evals"
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
- name: PostgreSQL connectivity smoke
run: >-
python -c "import psycopg;
conn=psycopg.connect('postgresql://openmathmodel:openmathmodel-dev@127.0.0.1:5432/openmathmodel');
assert conn.execute('SELECT 1').fetchone() == (1,);
conn.close()"
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