From 9a9f403d2b4d5e4d8eab86edacf0ee195abff411 Mon Sep 17 00:00:00 2001 From: 732642856 <732642856@qq.com> Date: Wed, 24 Jun 2026 15:22:54 +0800 Subject: [PATCH] Add CI failure diagnostics --- .github/workflows/ci.yml | 10 +++++++++- .github/workflows/release-quality-gate.yml | 10 +++++++++- .github/workflows/test.yml | 10 +++++++++- progress.md | 2 ++ task_plan.md | 3 ++- tests/test_frontend_productization.py | 22 ++++++++++++++++++++++ 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54ad178d..05c9ddc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,15 @@ jobs: run: python -m py_compile scripts/*.py jyotish_vedic/*.py mcp_server.py - name: Run quick quality gate - run: python scripts/run_quality_gate.py --profile quick --skip-yoga-logic + run: | + mkdir -p artifacts + python scripts/run_quality_gate.py --profile quick --skip-yoga-logic 2>&1 | tee artifacts/quick-quality-gate.log + - name: Upload quick quality gate diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: quick-quality-gate-diagnostics + path: artifacts/ - name: Build frontend run: npm run build --prefix jyotish-app diff --git a/.github/workflows/release-quality-gate.yml b/.github/workflows/release-quality-gate.yml index e2698cd0..3b231b9e 100644 --- a/.github/workflows/release-quality-gate.yml +++ b/.github/workflows/release-quality-gate.yml @@ -52,4 +52,12 @@ jobs: PY - name: Run release quality gate - run: python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240 + run: | + mkdir -p artifacts + python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240 2>&1 | tee artifacts/release-quality-gate.log + - name: Upload release quality gate diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: release-quality-gate-diagnostics + path: artifacts/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e0f72ec8..45111009 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,15 @@ jobs: npm --prefix jyotish-app exec -- vite --version test -x jyotish-app/node_modules/.bin/vite - name: Run pytest suite - run: python -m pytest -q + run: | + mkdir -p artifacts + python -m pytest -vv --maxfail=1 --junitxml=artifacts/pytest.xml 2>&1 | tee artifacts/pytest.log + - name: Upload pytest diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: pytest-diagnostics + path: artifacts/ - name: Run legacy runner run: python tests/run_all.py - name: Build frontend diff --git a/progress.md b/progress.md index 33233173..da77a863 100644 --- a/progress.md +++ b/progress.md @@ -303,3 +303,5 @@ - PR merge ref 复现:在 `/tmp/yinduzhanxing-pr6-merge` 拉取 `refs/pull/6/merge` 得到 `b614b03`;未安装前端依赖时可复现 `vite: command not found`,执行 `npm ci --prefix jyotish-app` 后 `python3 -m pytest tests/test_frontend_productization.py::test_local_frontend_and_api_runtime_smoke -q` 通过,`python3 scripts/run_quality_gate.py --profile quick --skip-yoga-logic` 通过,说明当前可复现路径不再指向产品代码行为缺陷。 - 完成 release-only workflow:新增 `.github/workflows/release-quality-gate.yml`,支持 `workflow_dispatch` 与关键路径 PR 触发,安装 Python/Node/Playwright Chromium 后运行 `python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240`;`.github/workflows/ci.yml` 与 `.github/workflows/test.yml` 增加 Python/Node/npm/Vite 诊断,便于云端失败时定位依赖安装差异。 - TDD/验证完成:新增 `test_github_release_quality_gate_runs_browser_release_profile` 静态契约;`python3 -B -m pytest tests/test_frontend_productization.py::test_github_release_quality_gate_runs_browser_release_profile tests/test_frontend_productization.py::test_quality_gate_declares_fast_browser_release_profiles -q` 通过;`.github/workflows/*.yml` PyYAML 解析通过;`git diff --check` 通过;`python3 scripts/run_quality_gate.py --profile quick --skip-yoga-logic` 通过,核心质量门 199 个 pytest、npm build 与 runtime smoke 通过。 +- 云端复查:PR #6 head `5399c6f` 的 `validate`、`test`、`release-quality-gate` 均失败;step metadata 显示依赖安装和 Vite 环境诊断已成功,失败仍发生在 pytest/quality gate 内部。GitHub annotations 仍只显示 exit code,日志/API 受权限限制;本机 Docker daemon 未运行,暂不能用 Linux 容器复现。 +- 增补 CI 失败诊断:`.github/workflows/test.yml` 的 pytest 改为 `-vv --maxfail=1 --junitxml=artifacts/pytest.xml` 并上传 `pytest-diagnostics`;`ci.yml` 与 `release-quality-gate.yml` 将 quality gate stdout tee 到 artifact 并上传,下一轮云端失败可直接定位首个 Linux runner 差异。 diff --git a/task_plan.md b/task_plan.md index 811588b2..9d94a3ad 100644 --- a/task_plan.md +++ b/task_plan.md @@ -98,4 +98,5 @@ - [x] Clean checkout CI 复现与修复:用干净 clone 复现 `.git/lost-found` 本机残留假设和 KP 外部 CSV fixture 缺失,修复为 clean checkout 可运行/可跳过的测试策略。 - [x] 发布包基础链路验证:wheel/sdist 构建成功,`twine check dist/*` 通过,全新 venv 安装 wheel 后 CLI help 可用。 - [x] PR merge ref 复现与 release-only workflow 守门:在 `/tmp/yinduzhanxing-pr6-merge` 拉取 PR #6 merge ref,确认完整依赖安装后 pytest 与 quick gate 通过;新增手动发布质量门 workflow 跑 release profile 与 Playwright Chromium,并为 CI/test workflow 增加 Vite/Node/Python 诊断。 -- [ ] 下一步:推送 release workflow 后复查 GitHub Actions 结果;若云端仍失败,依据新增诊断定位 runner 环境差异。 +- [x] CI 失败 artifact 诊断:pytest 改为 `-vv --maxfail=1 --junitxml`,quick/release quality gate 输出 tee 到 artifact,避免云端只暴露 exit code。 +- [ ] 下一步:推送 artifact 诊断后复查 GitHub Actions 结果;下载或读取诊断 artifact,按首个 Linux runner 失败继续修复。 diff --git a/tests/test_frontend_productization.py b/tests/test_frontend_productization.py index 2475c9bf..48d5d34a 100644 --- a/tests/test_frontend_productization.py +++ b/tests/test_frontend_productization.py @@ -564,10 +564,32 @@ def test_github_release_quality_gate_runs_browser_release_profile() -> None: "python -m pip install playwright", "python -m playwright install --with-deps chromium", "python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240", + "actions/upload-artifact@v4", + "release-quality-gate-diagnostics", + "release-quality-gate.log", ]: assert token in workflow +def test_github_ci_workflows_upload_failure_diagnostics() -> None: + ci = (ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8") + tests = (ROOT / ".github" / "workflows" / "test.yml").read_text(encoding="utf-8") + for token in [ + "actions/upload-artifact@v4", + "quick-quality-gate-diagnostics", + "quick-quality-gate.log", + ]: + assert token in ci + for token in [ + "actions/upload-artifact@v4", + "pytest-diagnostics", + "--junitxml=artifacts/pytest.xml", + "artifacts/pytest.log", + "--maxfail=1", + ]: + assert token in tests + + def test_auth_and_subscription_failures_have_recovery_guidance() -> None: auth = read("auth.js") subscription = read("subscription.js")