SuperAPI AI 工具集

frappe-testing-cicd

测试与质量

查看项目

更新于 10-15 22:17

技能介绍

用途:为 Frappe 应用搭建持续集成与持续交付流程,覆盖 GitHub Actions 测试工作流、pre-commit 钩子、代码检查、安全扫描、覆盖率与发布自动化。

主要能力:提供标准 Server Tests 工作流模板,含 MariaDB 与 Redis 服务、Python 版本矩阵、并行测试、JUnit XML 输出;提供 pre-commit 配置(ruff、prettier、eslint、commitlint);提供 ruff 与 ESLint 配置建议;提供 Semgrep 的 Frappe 专用安全规则(SQL 注入、字符串拼接、eval 使用);提供 coverage.py 配置与 Codecov 上传;提供基于 tag 的发布工作流与分支保护规则。

常用命令:pre-commit install --hook-type pre-commit --hook-type commit-msg;pre-commit run --all-files;ruff check .;ruff format .;npx eslint "**/*.js" --quiet;bench --site test_site run-tests --app myapp;bench --site test_site run-parallel-tests --total-builds 2 --build-number 0;coverage run -m pytest && coverage xml;bench --site test_site run-tests --junit-xml-output report.xml。

关键约定:ruff 使用 indent-style = "tab"、line-length 不低于 110、忽略 F401/F403/F405;ESLint 需声明 frappe、cur_frm、__ 等全局变量;CI 中必须包含 MariaDB 与 Redis 服务,并先创建站点再运行测试;Node 使用 18 或 20,不使用 16。

限制:内容聚焦 Frappe 应用,不涉及其他框架;部分配置为示例,需按项目实际调整。具体测试数量、覆盖率阈值、收费与平台范围暂未提供。