ci: use isolated self-hosted Windows Python runtime builds

This commit is contained in:
Tianyi Cui
2026-09-06 13:21:26 +08:00
parent 450d98b398
commit 69b1e315b4
9 changed files with 307 additions and 5 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write python/development.md
development.md: aa0144d7eaa66711d0f08316d4445da060918ca8
development.zh.md: a35f6fc8de1bdbd282fd8999a1440fde0c400b34
development.md: f1d3278deb621a73e6fafeb2fb65e6cfc14839d9
development.zh.md: 84744739da2a448de28a0ea24e6fa8e66c29e358
+2
View File
@@ -15,6 +15,8 @@ pnpm exec tsx scripts/build-exe-for-python-sdk.ts
Use `--skip-build` when the required `lib/` artifacts already exist, or `--targets=node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64` to select platforms. Build each target on its native architecture. Products land in `dist-exe/` and the script syncs the selected carriers into `python/sdk-runtime/`. Windows emits `.exe` and `-rg.exe`; macOS also syncs the matching spawn helper required by `node-pty`.
CI-only Windows x64 builds can use the self-hosted pool when `DSH_CI_FAILOVER_WINDOWS=selfhosted`: only same-repository non-fork, non-Dependabot pull requests and pushes to `master` qualify. The job downloads Python 3.10 into a private temporary directory without registering it in Windows, isolates build caches and test environments, and removes that directory after success or failure. Release and manual builds, Linux and macOS targets, and the SDK-wheel helper retain hosted runners. See the [runner isolation proposal](../.agents/notes/proposed/process/2026-09-06-python-runtime-windows-selfhosted.md) for image prerequisites and validation limits.
## Validate the SDK
Keep the virtual environment outside `python/`, install the test group, and run the Python suite:
+2
View File
@@ -15,6 +15,8 @@ pnpm exec tsx scripts/build-exe-for-python-sdk.ts
所需 `lib/` 产物已存在时使用 `--skip-build`;如需选择平台,请使用 `--targets=node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64`。每个目标都应在其原生架构上构建。产物写入 `dist-exe/`,脚本会将所选载体同步到 `python/sdk-runtime/`。Windows 会生成 `.exe``-rg.exe`macOS 构建还会同步 `node-pty` 所需的配套 spawn 辅助程序。
仅用于 CI 的 Windows x64 构建可在 `DSH_CI_FAILOVER_WINDOWS=selfhosted` 时使用自托管池:只有同仓库、非 fork、非 Dependabot 的拉取请求以及向 `master` 的推送符合条件。作业将 Python 3.10 下载到私有临时目录而不在 Windows 中注册它,隔离构建缓存与测试环境,并在成功或失败后删除该目录。发布与手动构建、Linux 与 macOS 目标,以及 SDK wheel 辅助作业仍使用托管运行器。镜像前提与验证限制见[运行器隔离提案](../.agents/notes/proposed/process/2026-09-06-python-runtime-windows-selfhosted.zh.md)。
## 验证 SDK
请将虚拟环境放在 `python/` 之外,安装测试组,然后运行 Python 测试套件: