diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8a4d731..ab8beff 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,11 +12,13 @@ on: paths: - 'apps/console/src-tauri/**' - 'apps/console/sidecar/**' + - 'scripts/prepare-console.mjs' - '.github/workflows/rust.yml' pull_request: paths: - 'apps/console/src-tauri/**' - 'apps/console/sidecar/**' + - 'scripts/prepare-console.mjs' - '.github/workflows/rust.yml' workflow_dispatch: @@ -66,6 +68,30 @@ jobs: - name: 构建 sidecar(resources 引用的产物) run: pnpm --filter nodeagent-console sidecar:build + # 随包分发的 Node 运行时由该脚本准备;它同时产出「构建期注入片段」。 + # 在此真跑一遍:既验证脚本本身可用(含产物自检:node 必须真能执行), + # 也验证注入片段声明的两份 resource 确实就绪。 + # 注意 Linux 上不会走 strip 分支(那是 macOS 专属,见脚本内注释), + # 故「strip 后必须 adhoc 重签」这条由 macOS 本机实测覆盖,CI 不重复验证。 + - name: 准备 Node 运行时(验证 prepare-console.mjs) + run: pnpm --filter nodeagent-console prepare:node + + - name: 注入片段应声明两份资源 + run: | + node -e ' + const g = require("./apps/console/src-tauri/tauri.bundle.gen.json"); + const r = g.bundle.resources; + const keys = Object.keys(r); + if (keys.length !== 2) { console.error("资源项应为 2,实际", keys); process.exit(1); } + console.log("✓", JSON.stringify(r)); + ' + + # 更强的一道:不是「文件在不在」,而是「产物能不能自举」—— + # 真 spawn 打包内的 node 跑 sidecar 并走一次 JSON-RPC 握手。 + # 这类问题只在产物中暴露(源码与单测都正常)。 + - name: 验证运行时 + sidecar 可自举 + run: node apps/console/scripts/verify-bundle.mjs --runtime + - name: 缓存 cargo 构建产物 uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/windows-e2e.yml b/.github/workflows/windows-e2e.yml index d78b242..661516d 100644 --- a/.github/workflows/windows-e2e.yml +++ b/.github/workflows/windows-e2e.yml @@ -48,6 +48,15 @@ jobs: - name: 类型检查 run: pnpm typecheck + + # 控制台「随包分发的 Node 运行时」在 Windows 上的分支此前零覆盖 + # (准备脚本本机只在 macOS 上跑过)。此处真跑:复制 node.exe(无 strip 分支)→ + # 自检可执行 → 再验证它与 sidecar 能否走通一次 JSON-RPC 自举。 + - name: 控制台 Node 运行时(Windows 分支)与自举验证 + run: | + pnpm --filter nodeagent-console prepare:node + node apps/console/scripts/verify-bundle.mjs --runtime + - name: 单元测试 — 协议纯函数 / 清单守护 / 脚本生成 # 来自 ci/workflow-unit-tests 分支(4d73d6e)的实质贡献;该分支基于老 main, # 直接 merge 会回退上万行,故只取其提交内容手工并入。