This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kb-web/.gitea/workflows/ci.yml
T
starmen1265 bbcd2eb80f
Test CI / 快速测试 (push) Failing after 2s
fix: 改进 PHP 语法检查输出
2026-03-01 23:47:29 +08:00

57 lines
1.4 KiB
YAML

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
# 代码检查
lint:
name: 代码检查
runs-on: linux
container:
image: gitea-runner-php:latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装依赖
run: composer install --prefer-dist --no-progress --no-interaction
- name: PHP 语法检查
run: |
echo "📝 PHP 语法检查..."
# 检查所有 PHP 文件(排除 vendor),保存完整输出
{
find . -name "*.php" -not -path "./vendor/*" -exec sh -c 'php -l "$1" 2>&1 || true' _ {} \;
} > /tmp/lint_output.txt
# 检查是否有错误
if grep -q "^Parse error\|^Fatal error\|^Syntax error" /tmp/lint_output.txt; then
echo "❌ PHP 语法错误:"
cat /tmp/lint_output.txt
exit 1
else
echo "✅ 所有 PHP 文件语法正确"
fi
# 单元测试
test:
name: 单元测试
runs-on: linux
container:
image: gitea-runner-php:latest
needs: lint
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装依赖
run: composer install --prefer-dist --no-progress --no-interaction
- name: 运行测试
run: composer test