gongxiangp2/docs/development/pr-ci-pipeline.md

18 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# PR 级自动化 CI 流水线说明
仓库使用 [`.github/workflows/ci.yml`](../../.github/workflows/ci.yml) 作为 PR 与手动触发(`workflow_dispatch`)的统一质量闸门,所有 Node 作业统一对齐 **Node 24.22.1**(与 `package.json`、`apps/detail-agent-pi/package.json` 及 `Dockerfile` 一致)。
## 作业拆分与路径过滤
1. **`changes`**([`scripts/ci/detect-pr-changes.mjs`](../../scripts/ci/detect-pr-changes.mjs)):基于 `git diff --name-only` 识别变更范围,避免无关 PR 触发全量重型构建;`workflow_dispatch` 时默认全量执行。
2. **`security`**([`scripts/ci/check-pr-security.mjs`](../../scripts/ci/check-pr-security.mjs)):每个 PR 必跑的快速卡点,拦截 `.env`(`*.example` 除外)、`.private/`、私钥文件及 diff 新增明文凭据,并执行 `apps/detail-agent-pi/src/` 白标静态扫描。
3. **`web`**:主站 / 脚本 / Prisma / `Dockerfile` 变更时执行 `npm run storage:legacy-boundary`、`npm run typecheck -- --incremental false`、`npm run test:scripts`(含 `safe-production-migrate.test.mjs` 与 `ci-workflows.test.mjs`)及 `npm test -- --maxWorkers=2`。
4. **`agent`**:`apps/detail-agent-pi/` 或 `evals/xiaoyi-golden/` 变更时执行 `npm run test:agent`(含 `whitelabel`、`kb-antileak`、`thin-speed-124`)及 `node --test evals/xiaoyi-golden/tests/*.test.mjs` 20 模板离线契约烟测。
5. **`rust`**:`apps/detail-photocraft/` 变更时在 `CARGO_INCREMENTAL=0` 与 `CARGO_PROFILE_DEV_DEBUG=0` 下执行 `x86_64-pc-windows-gnu` 交叉编译检查与核心纯逻辑 crate 单测,并在 `if: always()` 收尾步骤清理 `target/debug` 与 `target/x86_64-pc-windows-gnu/debug` 防爆盘。
## 本地校验
```powershell
node --test scripts/ci-workflows.test.mjs
```