From 05ef6ecb14fed2bb8bf1ded958b7efc13c9581a4 Mon Sep 17 00:00:00 2001 From: starmen1265 Date: Mon, 2 Mar 2026 01:18:52 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=202026-03-02=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=BF=97=20-=20Gitea=20CI=20?= =?UTF-8?q?=E6=8E=92=E6=9F=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agents/haonan/workspace/memory/2026-03-02.md | 44 ++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/agents/haonan/workspace/memory/2026-03-02.md b/agents/haonan/workspace/memory/2026-03-02.md index ee6b791..535ed8e 100644 --- a/agents/haonan/workspace/memory/2026-03-02.md +++ b/agents/haonan/workspace/memory/2026-03-02.md @@ -1,24 +1,54 @@ # 2026-03-02 工作日志 -## Gitea Actions CI 问题排查 +## Gitea Actions CI 问题排查 - 成功 ✅ ### 问题描述 - CI 输出被截断,看不到详细错误信息 - 多次修改 ci.yml 但输出不变 +- PHP 语法检查形同虚设(退出码问题) +- test.yml 和 ci.yml 触发条件混乱 ### 根本原因 1. **workflow 缓存问题**:act runner 缓存了 workflow 文件 2. **分支触发问题**:ci.yml 只在 main/develop 触发,feature 分支触发的是 test.yml +3. **find -exec 退出码问题**:只反映 find 自身,不反映 php -l 的失败状态 ### 解决方案 1. 清除 act 缓存:`rm -rf ~/.cache/act ~/.cache/actcache` 2. 重启 act_runner daemon 3. 修改 ci.yml 触发条件为所有分支 -4. 更新自定义镜像添加 Node.js +4. 更新自定义镜像添加 Node.js(gitea-runner-php:latest) +5. 修复 PHP 语法检查脚本:正确捕获退出码 +6. 删除 test.yml,统一使用 ci.yml -### 当前状态 -- 正在构建新镜像 `gitea-runner-php:latest`(含 Node.js) -- 添加了 nodejs 和 npm 到 Dockerfile +### 最终 CI 配置 +```yaml +on: + push: + branches: ["**"] + pull_request: + branches: [main, develop] +``` -### 后续 -- 镜像构建完成后需要重新测试 CI +### PHP 语法检查(正确版本) +```bash +errors=0 +for file in $(find . -name "*.php" -not -path "./vendor/*"); do + if ! php -l "$file" > /dev/null 2>&1; then + echo "❌ 语法错误: $file" + php -l "$file" + errors=$((errors + 1)) + fi +done +if [ $errors -gt 0 ]; then + echo "发现 $errors 个语法错误" + exit 1 +fi +echo "✅ 所有 PHP 文件语法正确" +``` + +### 修复的文件 +- index.php(缺少分号) +- ci.yml(多处修改) +- docker/runner/Dockerfile(添加 Node.js) +- 删除 test.yml