Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 77 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
build:
name: 类型与构建 · ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand All @@ -34,6 +35,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm

- name: 安装 JS 依赖
run: npm ci --no-audit --no-fund
Expand All @@ -43,15 +45,76 @@ jobs:
- name: 内核语法检查
run: python -m compileall -q modeling gateway

- name: 依赖方向守卫(gateway 不得 import modeling)
shell: bash
run: |
python - <<'PY'
import pathlib, re, sys
bad = [
str(p) for p in pathlib.Path('gateway/src').rglob('*.py')
if re.search(r'(import|from)\s+mms_modeling', p.read_text(encoding='utf-8'))
]
print('gateway -> modeling imports:', bad or 'none')
sys.exit(1 if bad else 0)
PY

- name: 类型检查
run: npm run typecheck

- name: 构建
run: npm run build

core-pipeline:
name: 核心离线全链 · ubuntu
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4

- name: 准备 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: 装数值依赖
run: |
python -m pip install --upgrade pip
python -m pip install -r modeling/requirements.txt

- name: 装排版工具
run: |
sudo apt-get update -q
sudo apt-get install -yq pandoc texlive-xetex texlive-lang-chinese texlive-latex-extra

- name: 跑离线全链
run: |
mkdir -p runs/ci
printf '某工厂有 120 条生产线,附件给出每条产线的温度、压力与产量记录。问题一:建立产量与温度、压力的关系模型并做预测;问题二:分析异常产线并给出改进建议;问题三:评估模型稳健性。\n' > runs/ci/problem.txt
python modeling/cli.py run --problem-file runs/ci/problem.txt --out runs/ci/out

- name: 断言产物
run: |
python - <<'PY'
import json, pathlib, sys
out = pathlib.Path('runs/ci/out')
result = json.loads((out / 'code' / 'outputs' / 'result.json').read_text(encoding='utf-8'))
pdf = out / 'paper' / 'paper.pdf'
docx = out / 'paper' / 'paper.docx'
checks = {
'result.ok': bool(result.get('ok')),
'figure.png': (out / 'code' / 'outputs' / 'figure.png').is_file(),
'paper.pdf': pdf.is_file() and pdf.open('rb').read(4) == b'%PDF',
'paper.docx': docx.is_file() and docx.open('rb').read(2) == b'PK',
}
print(checks)
sys.exit(0 if all(checks.values()) else 1)
PY

window-smoke:
name: 真启动冒烟 · ubuntu
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
Expand All @@ -65,10 +128,23 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm

- name: 安装 JS 依赖(含 Electron 二进制)
- name: 安装 JS 依赖
run: npm ci --no-audit --no-fund

- name: 取回 Electron 二进制
# npm ci 在此环境不触发 electron 下载,dist/ 为空;显式跑 install.js,失败重试三次。
run: |
ok=0
for attempt in 1 2 3; do
if node node_modules/electron/install.js; then ok=1; break; fi
echo "第 $attempt 次取回 Electron 失败,10 秒后重试"
sleep 10
done
[ "$ok" = 1 ] || exit 1
ls -l node_modules/electron/dist | head -12

- name: 构建
run: npm run build

Expand Down
Loading