- add prepare.yml: install tools + maintain shared bare repo, anchors the workflow_run chain - add checks.yml: merge lint + full test suite into a single workflow_run consumer job - remove standards-check.yml and test.yml (superseded by checks.yml) - convert sync-tsl-playbook and update-thirdparty-skills to worktree-model consumers - unify workflow/job/step display names and emoji
59 lines
2.1 KiB
Markdown
59 lines
2.1 KiB
Markdown
# 🧪 Playbook 测试套件
|
||
|
||
本目录包含 Playbook 项目的测试,用于验证 CLI、模板与文档链接。
|
||
|
||
## 📋 目录结构
|
||
|
||
```txt
|
||
test/
|
||
├── README.md # 本文件:测试文档
|
||
├── test_playbook.py # snapshot/subtree 参数化完整部署测试
|
||
├── test_template_contracts.py # 模板内容、占位符、文案契约测试
|
||
├── test_main_loop_cli.py # main_loop CLI 测试
|
||
├── agent/ # Agent 题面/运行时验证测试定义
|
||
├── test_thirdparty_skills_pipeline.py # thirdparty skills 流水线配置与同步产物测试
|
||
└── integration/ # 集成测试
|
||
└── check_doc_links.py # 文档链接有效性检查
|
||
```
|
||
|
||
## 🚀 快速开始
|
||
|
||
```bash
|
||
# 进入 playbook 根目录
|
||
cd /path/to/playbook
|
||
|
||
# 1. 运行 Python 测试(test/ 下的 test_*.py)
|
||
python -m unittest discover -s test -p "test_*.py" -v
|
||
|
||
# 2. 运行文档链接检查
|
||
python test/integration/check_doc_links.py
|
||
```
|
||
|
||
## 🧭 CI 自动化测试
|
||
|
||
测试套件通过 Gitea Actions 自动运行(见 `.gitea/workflows/checks.yml` 的 `tests` job):
|
||
|
||
- **触发方式**:`workflow_run`——「🧰 准备环境」(`prepare.yml`)完成后触发。
|
||
Prepare 监听 `push:main`、`pull_request`、`workflow_dispatch` 与每日 `schedule`,
|
||
故推送到 main、对 main 开 PR 或手动运行 Prepare 都会经 Prepare 传导到测试。
|
||
- **运行平台**:standard-ubuntu-22
|
||
- **注**:`checks.yml` 同时包含 commit message 规范校验(`standards` job)。
|
||
|
||
## 📚 测试详解
|
||
|
||
### 1. Playbook 部署测试 (`test_playbook.py`)
|
||
|
||
使用同一个完整 `playbook.toml` 参数化验证:
|
||
|
||
- snapshot 与 subtree 两种安装模式
|
||
- rules、memory bank、prompts、standards 和 skills 同步
|
||
- 重复执行的幂等性与自定义文件保留
|
||
|
||
### 2. 模板合同测试 (`test_template_contracts.py`)
|
||
|
||
随 Python 测试检查通用模板的关键 marker、占位符和流程合同。
|
||
|
||
### 3. 文档链接检查 (integration/)
|
||
|
||
扫描 `docs/` 与模板文件中的本地链接,确保引用路径有效。
|