diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06951c5e..54ad178d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,14 @@ jobs: python -m pip install -r requirements.txt -r requirements-dev.txt npm ci --prefix jyotish-app + - name: Print environment diagnostics + run: | + python --version + node --version + npm --version + npm --prefix jyotish-app exec -- vite --version + test -x jyotish-app/node_modules/.bin/vite + - name: Run Ruff lint for quality gate files run: ruff check scripts/run_quality_gate.py tests/test_varga_bphs.py tests/test_ashtakavarga_invariants.py tests/test_cli_smoke.py tests/test_yoga_rules_integrity.py diff --git a/.github/workflows/release-quality-gate.yml b/.github/workflows/release-quality-gate.yml new file mode 100644 index 00000000..e2698cd0 --- /dev/null +++ b/.github/workflows/release-quality-gate.yml @@ -0,0 +1,55 @@ +name: Jyotish Release Quality Gate + +on: + workflow_dispatch: + pull_request: + branches: [main] + paths: + - '.github/workflows/release-quality-gate.yml' + - 'scripts/run_quality_gate.py' + - 'tests/run_frontend_click_smoke.py' + - 'tests/run_frontend_runtime_smoke.py' + - 'jyotish-app/**' + +jobs: + release-quality-gate: + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + cache-dependency-path: jyotish-app/package-lock.json + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt -r requirements-dev.txt + python -m pip install playwright + python -m playwright install --with-deps chromium + npm ci --prefix jyotish-app + + - name: Print environment diagnostics + run: | + python --version + node --version + npm --version + npm --prefix jyotish-app exec -- vite --version + python - <<'PY' + from pathlib import Path + print("frontend node_modules:", (Path("jyotish-app") / "node_modules").exists()) + print("vite binary:", (Path("jyotish-app") / "node_modules" / ".bin" / "vite").exists()) + PY + + - name: Run release quality gate + run: python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4593e3a2..e0f72ec8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,13 @@ jobs: python -m pip install --upgrade pip python -m pip install -r requirements.txt -r requirements-dev.txt npm ci --prefix jyotish-app + - name: Print environment diagnostics + run: | + python --version + node --version + npm --version + npm --prefix jyotish-app exec -- vite --version + test -x jyotish-app/node_modules/.bin/vite - name: Run pytest suite run: python -m pytest -q - name: Run legacy runner diff --git a/progress.md b/progress.md index a2e75f5b..33233173 100644 --- a/progress.md +++ b/progress.md @@ -300,3 +300,6 @@ - 继续复查 PR #6 Actions:Ruff 已转绿,但 `quick quality gate` 与 `pytest suite` 仍失败;在 `/tmp/yinduzhanxing-ci-repro` 干净 clone 复现,根因为 `test_fragment_audit_blocks_registry_surface_drift` 假设 `.git/lost-found` 一定存在,以及 `test_kp_system.py` 依赖未纳入 Git 的 `VedicAstro/vedicastro/data/KP_SL_Divisions.csv`。 - 修复 clean checkout 测试依赖:碎片审计测试改为检查 lost-found 字段结构而非要求本机残留数量;KP 外部 oracle CSV 缺失时明确 `pytest.skip`,保留内建 360° wrap 测试。 - 发布包链路进展:`python3 -m build --no-isolation --wheel --sdist` 成功生成 wheel/sdist;`python3 -m twine check dist/*` 通过;全新 venv 安装 wheel 后 `jyotish-engine --help` 可用。 +- 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 通过。 diff --git a/task_plan.md b/task_plan.md index ba1f231a..811588b2 100644 --- a/task_plan.md +++ b/task_plan.md @@ -97,4 +97,5 @@ - [x] GitHub Actions 失败根因修复:本地复现 PR `validate` 的 Ruff E402 与 `test` 全量 pytest 的 WorkBuddy 旧 skill 路径污染,新增 pytest import guard 并修复 Ashtakavarga lint。 - [x] Clean checkout CI 复现与修复:用干净 clone 复现 `.git/lost-found` 本机残留假设和 KP 外部 CSV fixture 缺失,修复为 clean checkout 可运行/可跳过的测试策略。 - [x] 发布包基础链路验证:wheel/sdist 构建成功,`twine check dist/*` 通过,全新 venv 安装 wheel 后 CLI help 可用。 -- [ ] 下一步:推送 clean checkout 修复后复查 GitHub Actions 结果;补充 release-only workflow 的 browser/release 守门。 +- [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 环境差异。 diff --git a/tests/test_frontend_productization.py b/tests/test_frontend_productization.py index 4eb20f9e..2475c9bf 100644 --- a/tests/test_frontend_productization.py +++ b/tests/test_frontend_productization.py @@ -553,6 +553,21 @@ def test_release_quality_gate_tracks_untracked_product_files() -> None: assert path in quality_gate.RELEASE_CRITICAL_UNTRACKED_PATHS +def test_github_release_quality_gate_runs_browser_release_profile() -> None: + workflow = (ROOT / ".github" / "workflows" / "release-quality-gate.yml").read_text(encoding="utf-8") + for token in [ + "workflow_dispatch", + "pull_request", + "python-version: '3.11'", + "node-version: '20'", + "npm ci --prefix jyotish-app", + "python -m pip install playwright", + "python -m playwright install --with-deps chromium", + "python scripts/run_quality_gate.py --profile release --frontend-click-timeout 240", + ]: + assert token in workflow + + def test_auth_and_subscription_failures_have_recovery_guidance() -> None: auth = read("auth.js") subscription = read("subscription.js")