Skip to content

ci: 构建前安装 zstandard,启用 Nuitka onefile 压缩(Linux 产物 250MB → ~40MB) - #110

Merged
This-is-XiaoDeng merged 1 commit into
ITCraftDevelopmentTeam:masterfrom
This-is-XiaoDeng:fix/linux-onefile-compression
Aug 13, 2026
Merged

ci: 构建前安装 zstandard,启用 Nuitka onefile 压缩(Linux 产物 250MB → ~40MB)#110
This-is-XiaoDeng merged 1 commit into
ITCraftDevelopmentTeam:masterfrom
This-is-XiaoDeng:fix/linux-onefile-compression

Conversation

@This-is-XiaoDeng

Copy link
Copy Markdown
Member

问题

Linux 产物 250MB,Windows/macOS 仅 ~37MB。

根因:Nuitka onefile 默认用 zstandard 压缩 payload,但 Ubuntu runner 上没有
带 zstandard 的 Python 可用,构建日志警告:
Onefile mode cannot compress without 'zstandard' package installed
payload 原样打包(已确认二进制内 0 个 zstd 魔数)。

修复

每个构建 job 在 Nuitka 编译前增加 poetry run pip install zstandard
Nuitka 的 findInstalledPython 会优先扫描当前 Python,安装后即可启用压缩。

预期

Linux 产物从 250MB 压缩到 ~40MB 级别,运行时行为不变(onefile 自动解压)。

Linux 产物 250MB 而 Windows/macOS 仅 ~37MB 的原因:Nuitka onefile 默认
用 zstandard 压缩 payload,但 Ubuntu runner 上找不到带 zstandard 的
Python,构建日志警告 'Onefile mode cannot compress without zstandard
package installed',payload 原样打包。

修复:每个构建 job 在编译前 poetry run pip install zstandard
(Nuitka 会扫描当前 Python),Linux 产物预计压缩到 ~40MB 级别。
@github-actions
github-actions Bot requested a review from montmorill August 13, 2026 10:10
@This-is-XiaoDeng
This-is-XiaoDeng merged commit 2eb58a4 into ITCraftDevelopmentTeam:master Aug 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant