添加完整 CI/CD 流程

- Gitea Actions 配置 (.gitea/workflows/ci.yml)
- PHPUnit 测试框架 (composer.json, phpunit.xml)
- 示例测试用例 (tests/Unit, tests/Feature)
- .gitignore 配置

流程说明:
1. feature/* 分支 push → 部署测试环境 → 运行测试
2. 测试失败 → 自动回退 + 通知
3. 测试通过 → 自动合并到 main → 部署正式环境
4. main 分支 push → 直接部署正式环境

需要配置 Secrets:
- DEPLOY_KEY: SSH 私钥
- GITEA_TOKEN: 用于自动合并的 Token
This commit is contained in:
2026-02-15 09:07:10 +08:00
parent 7eba30ee46
commit 25c9002cbe
6 changed files with 211 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
{
"name": "starmen1265/kb-web",
"description": "知识库网页系统",
"type": "project",
"require": {
"php": ">=8.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit --testdox",
"test:coverage": "phpunit --coverage-html coverage"
}
}