diff --git a/docs/superpowers/specs/2026-05-27-v4.2-ci-cd-design.md b/docs/superpowers/specs/2026-05-27-v4.2-ci-cd-design.md new file mode 100644 index 0000000..0115cfc --- /dev/null +++ b/docs/superpowers/specs/2026-05-27-v4.2-ci-cd-design.md @@ -0,0 +1,51 @@ +# v4.2 CI/CD 流水线 — 设计文档 + +**日期**: 2026-05-27 +**分支**: v4.2 +**状态**: 已确认 + +## 概述 + +为 PathEditor 添加 GitHub Actions CI/CD,实现 push 自动检查 + tag 自动构建发布。 + +## 触发策略 + +| 触发条件 | 做什么 | +|----------|--------| +| push 任意分支(不含 tag) | 前端类型检查 + lint + 测试,Rust check + clippy + test | +| 推送 tag `v*` | Tauri 构建 NSIS 安装包,上传到 GitHub Release | + +## Workflow 1: CI + +**文件**: `.github/workflows/ci.yml` + +两个并行 job: + +**frontend (ubuntu-latest)**: +- 用 ubuntu 而非 windows,更快且不依赖系统 API +- 步骤:checkout → setup-node → npm ci → tsc --noEmit → npm run lint → npm test + +**rust (windows-latest)**: +- 必须用 windows(`winreg` crate 依赖 Windows API) +- 安装 GNU 工具链并 override,添加 MinGW bin 到 PATH +- 步骤:checkout → rustup toolchain install → override → PATH → cargo check → cargo clippy -- -D warnings → cargo test + +## Workflow 2: Release + +**文件**: `.github/workflows/release.yml` + +单一 job `build-and-release` (windows-latest): +- checkout → setup-node → npm ci → rustup + MinGW → npx tauri build → gh release upload + +构建产物:NSIS 安装包(`.exe`),上传到对应 tag 的 GitHub Release。 + +## MinGW 处理 + +- GitHub Actions `windows-latest` 自带 MSYS2,MinGW 位于 `C:\msys64\mingw64\bin` +- `cargo test` 运行时需要 `libmcfgthread-2.dll`,将此路径加入 `PATH` 即可 + +## 范围限制 + +- 不做跨平台构建(项目仅面向 Windows) +- 不做覆盖率门槛 +- Release 不重复跑 CI(tag 推送说明已通过 push 检查)