ci: 添加测试相关的CI脚本

添加多个测试脚本用于CI流程,包括完整CI流程、Phpspec测试、静态分析、所有测试、代码风格修复与检查以及单元测试
This commit is contained in:
李东云
2025-11-28 17:59:33 +08:00
parent e92a6f46a4
commit 327066b146
7 changed files with 42 additions and 0 deletions

6
scripts/test/all-tests.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 运行所有 Pest 测试脚本
# 运行所有 Pest 测试(包括数据库测试)
./run-in-docker.sh vendor/bin/pest --coroutine --prepend=tests/bootstrap.php --colors=always

6
scripts/test/ci.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 完整的 CI 流程脚本
# 运行完整的 CI 流程
./run-in-docker.sh composer ci

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 代码风格检查脚本
# 检查代码风格,只使用配置文件中定义的规则
./run-in-docker.sh vendor/bin/php-cs-fixer check app/ --allow-risky=yes --config=.php-cs-fixer.dist.php

6
scripts/test/code-style-fix.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 代码风格修复脚本
# 修复代码风格,只使用配置文件中定义的规则
./run-in-docker.sh vendor/bin/php-cs-fixer fix app/ tests/ --allow-risky=yes --config=.php-cs-fixer.dist.php

6
scripts/test/phpspec-tests.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# Phpspec BDD 测试脚本
# 运行所有 Phpspec 测试
./run-in-docker.sh vendor/bin/phpspec run

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 代码静态分析脚本
# 运行完整的代码静态分析
./run-in-docker.sh vendor/bin/phpstan analyse app/ tests/

6
scripts/test/unit-tests.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
# 非数据库依赖的单元测试脚本
# 运行非数据库依赖的单元测试
./run-in-docker.sh vendor/bin/pest tests/Unit/ --exclude-group database --coroutine --prepend=tests/bootstrap.php --colors=always