63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
# CI 基线(任务 A1.6):平台门禁 + APS 分流
|
||
# 平台:typecheck / lint / 依赖方向 / 跨库访问 / 能力描述 / 测试
|
||
# APS:目前尚无代码,检测到 aps/ 下有 Python 文件时自动启用(B1 落地后接 ruff + pytest)
|
||
name: ci
|
||
|
||
on:
|
||
push:
|
||
branches: [rewrite/platform, main]
|
||
pull_request:
|
||
|
||
jobs:
|
||
platform:
|
||
runs-on: ubuntu-latest
|
||
env:
|
||
# 双保险:CI 里永远不走真引擎(测试自己也注入 fake,见 startServer 的 engine 参数)
|
||
APS_ENGINE: fake
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: pnpm/action-setup@v4
|
||
with:
|
||
version: 11
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version: '22.19.0'
|
||
cache: pnpm
|
||
- run: pnpm install --frozen-lockfile
|
||
- name: typecheck
|
||
run: pnpm typecheck
|
||
- name: lint
|
||
run: pnpm lint
|
||
- name: 依赖方向检查
|
||
run: pnpm check:deps
|
||
- name: 跨库访问检查
|
||
run: pnpm check:db
|
||
- name: 能力描述检查
|
||
run: pnpm check:capabilities
|
||
- name: 测试(契约 / 依赖方向 / 跨库 / 能力描述 / 服务端冒烟)
|
||
run: pnpm test
|
||
|
||
aps:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: 检测 APS 代码
|
||
id: detect
|
||
run: |
|
||
if compgen -G "aps/**/*.py" > /dev/null; then
|
||
echo "found=true" >> "$GITHUB_OUTPUT"
|
||
else
|
||
echo "found=false" >> "$GITHUB_OUTPUT"
|
||
echo "aps/ 下暂无 Python 代码,跳过(B1 落地后自动启用)"
|
||
fi
|
||
- uses: actions/setup-python@v5
|
||
if: steps.detect.outputs.found == 'true'
|
||
with:
|
||
python-version: '3.11'
|
||
- name: APS 检查(ruff + pytest)
|
||
if: steps.detect.outputs.found == 'true'
|
||
run: |
|
||
python -m pip install --upgrade pip
|
||
pip install ruff pytest
|
||
ruff check aps
|
||
pytest aps -q |