添加完整 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:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 示例单元测试
|
||||
*/
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConfigTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* 测试配置文件存在
|
||||
*/
|
||||
public function testConfigFileExists(): void
|
||||
{
|
||||
$this->assertFileExists(__DIR__ . '/../../config.php', '配置文件应该存在');
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试样式文件存在
|
||||
*/
|
||||
public function testStyleFileExists(): void
|
||||
{
|
||||
$this->assertFileExists(__DIR__ . '/../../style.css', '样式文件应该存在');
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试入口文件存在
|
||||
*/
|
||||
public function testIndexFileExists(): void
|
||||
{
|
||||
$this->assertFileExists(__DIR__ . '/../../index.php', '入口文件应该存在');
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试仪表盘文件存在
|
||||
*/
|
||||
public function testDashboardFileExists(): void
|
||||
{
|
||||
$this->assertFileExists(__DIR__ . '/../../dashboard.php', '仪表盘文件应该存在');
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试查看文件存在
|
||||
*/
|
||||
public function testViewFileExists(): void
|
||||
{
|
||||
$this->assertFileExists(__DIR__ . '/../../view.php', '查看文件应该存在');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user