fix: 司马懿 Review M1-M3 修复
CI / lint (push) Failing after -3m47s
CI / test (push) Has been skipped
CI / lint (pull_request) Failing after -3m57s
CI / test (pull_request) Has been skipped
CI / notify-on-failure (push) Successful in -4m3s
CI / notify-on-failure (pull_request) Successful in -4m3s

M1: runs-on ubuntu-latest → macos-arm64(匹配 act-runner label)
M2: flake8 → ruff(对齐设计文档 §8.4)
M3: ci.yml 排除 main 改为注释说明(main 由 deploy.yml 负责)
S1: deploy.yml 加 coverage report step
S3: pip install -r requirements.txt → -e .[dev]
S4: ci.yml 非 PR 事件 CI 失败改创建 Issue
This commit is contained in:
cfdaily
2026-06-06 17:23:29 +08:00
parent db184c32b5
commit 163e778096
3 changed files with 143 additions and 17 deletions
+17 -7
View File
@@ -1,7 +1,9 @@
# 部署管道 — moziplus v2.0
#
# 触发条件:
# - push 到 main 分支
# - push 到 main 分支 → 完整 CIlint + test + coverage+ 部署
#
# 注意:非 main 分支的 CI 由 ci.yml 负责(快速门控)
#
# Gitea v1.23.4 限制注意:
# - 不支持 failure() 表达式
@@ -17,26 +19,30 @@ on:
jobs:
# ── Job 1: CI(main 分支跑完整测试)─────────────────
ci:
runs-on: ubuntu-latest
runs-on: macos-arm64
steps:
- uses: actions/checkout@v4
- name: Setup Python
run: |
python3 -m venv .venv
.venv/bin/pip install --quiet -r requirements.txt
.venv/bin/pip install --quiet -e ".[dev]"
- name: Lint
run: |
.venv/bin/flake8 src/ --max-line-length=120 --extend-ignore=E501
.venv/bin/ruff check src/
- name: Unit & Integration Tests
run: |
.venv/bin/pytest tests/ -m "not e2e" -x -q
- name: Coverage Report
run: |
.venv/bin/pytest tests/ -m "not e2e" --cov=src --cov-report=term-missing -q
# ── Job 2: 部署 ─────────────────────────────────────
deploy:
runs-on: ubuntu-latest
runs-on: macos-arm64
needs: ci
steps:
- uses: actions/checkout@v4
@@ -56,13 +62,17 @@ jobs:
# TODO: 实际部署脚本
# bash scripts/deploy.sh --source="$GITHUB_WORKSPACE" --target="$HOME/.sanguo_projects/sanguo_moziplus_v2" --health-check
echo "Deploy placeholder completed."
# placeholder: 后续替换为实际部署脚本
true
- name: Health check
run: |
echo "=== Health check ==="
echo "=== Health check (placeholder) ==="
# TODO: 等服务启动后做健康检查
# curl -sf http://localhost:8083/api/health || exit 1
echo "Health check placeholder passed."
# placeholder: 后续替换为实际健康检查
true
# ── 失败时回滚 ────────────────────────────────
# v1.23 不支持 if: failure()
@@ -71,7 +81,7 @@ jobs:
# ── Job 3: 部署失败通知 ──────────────────────────────
notify-deploy-failure:
runs-on: ubuntu-latest
runs-on: macos-arm64
needs: [ci, deploy]
if: always()
steps: