Skip to content

fix(ci): Windows 目标 clippy 不再编译自带的 SQLite,补上停摆期间漏检的告警 (Refs 1lck/Lithe-IDEA#2231) - #170

Merged
xiaoyumuxi merged 1 commit into
mainfrom
fix/2231-windows-lint-sqlite
Nov 22, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
fix/2231-windows-lint-sqlite

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

关联 Issue

Refs 1lck/Lithe-IDEA#2231(远程开发完整设计)。#154 引入 Motty 导入后,所有 Core PR 的 Rust Core / Linux 都在 “Lint for Windows” 步骤失败,Rust Core gate 也跟着失败(例如 #169 的 run 44987781337)。这个 PR 修复这个步骤,并修掉它停摆期间漏检的 Windows clippy 错误。

类型

  • fix:CI 的 Windows 目标 clippy 恢复可用;不改产品代码,不新增 CI 步骤

原因

  1. feat(remote): 连接窗口的地址解析、搜索、导入、ssh -G 生效值和连接阶段(#2231) #154 给 lithe-remote 加了 motty 功能(rusqlite,打开 bundled),lithe-workspace 默认打开它。从这时起,“Lint for Windows” 选中的 crate 包含 lithe-workspace(选择结果变成 --workspace)。从 2026-11-21 起,每个 PR 都在这一步编译 libsqlite3-sys。

  2. bundled 要用 cc 编译 SQLite 的 C 源码,目标 x86_64-pc-windows-msvc 需要 MSVC 的 cl.exe 和 lib.exe,Linux runner 上没有,所以报错:

    error occurred in cc-rs: GNU compiler is not supported for this target
    failed to find tool "lib.exe"
    
  3. 这一步在依赖编译阶段就失败了,后面的 clippy 一次都没有跑到,Windows 目标的告警因此漏了进来:crates/workspace/src/ssh_configuration/tests.rs 里的 Directory::write、lines、DEFAULTS 只被 #[cfg(unix)] 的测试使用,在 Windows 上是死代码(-D dead-code)。

改动说明

.github/workflows/rust-core.yml

  • 只修改已有的 “Lint for Windows” 步骤,给它加上环境变量 LIBSQLITE3_SYS_USE_PKG_CONFIG=1,没有新增步骤。设了这个变量,libsqlite3-sys 的构建脚本就改走“链接系统库”的分支:只复制它自带的预生成绑定(和 bundled 时用的是同一份),只输出链接指令,不编译 C 源码。clippy 只做检查、不链接,所以检查范围和结果都不变。
  • 步骤注释补上了这样做的原因。

rust/crates/workspace/src/ssh_configuration/tests.rs

  • Directory::write、lines、DEFAULTS 加上 #[cfg(unix)],和用到它们的测试一致。这些测试运行的 fake_ssh 是 shell 脚本,只能在 Unix 上跑。

CONTRIBUTING.md

  • 中英两段 “手边没有 Windows 时” 的本地 Windows clippy 命令都加上这个变量,并说明原因;不加的话,在 macOS 和 Linux 上会遇到同样的错误。

产品构建不受影响:桌面端 Core 在 Windows 上仍然编译并静态链接自带的 SQLite。这个变量只设在 CI 的 lint 步骤,以及文档里的本地检查命令中。

验证

  • macOS(Rust 1.100.0):
    • LIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --locked --keep-going --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings 通过。改测试之前,只有上面 3 个 lithe-workspace 错误。
    • cargo fmt --all -- --check 通过。
    • scripts/rust-core/verify-rust-core-comments.sh workspace 通过。
    • cargo clippy -p lithe-workspace --all-targets --all-features -- -D warnings 通过。
    • cargo test -p lithe-workspace ssh_configuration:8 个测试通过。
  • Linux 容器(rust:1.100.0,arm64 原生):在同一份源码上对 lithe-remote --features motty 跑 Windows 目标 clippy。不设变量时退出码 101,报 libsqlite3-sys@0.30.1: GNU compiler is not supported for this target,和 CI 一样;设了变量退出码 0。
  • 这次改的是 CI 步骤,所以等这个 PR 第一次运行 Rust Core / Linux 的结果。

…e-IDEA#2231)

#154 给 lithe-remote 加了 motty(bundled rusqlite),lithe-workspace 默认
打开它。从那以后,“Lint for Windows” 在 Linux runner 上编译 SQLite 的 C
源码时找不到 MSVC 的 lib.exe,所有 PR 的 Rust Core / Linux 和 gate 都失败。

- 这个步骤加 LIBSQLITE3_SYS_USE_PKG_CONFIG=1:libsqlite3-sys 只复制预生成
  绑定、输出链接指令,不编译 C 源码。clippy 不链接,检查结果不变。
- 步骤停摆期间漏进来的告警:ssh_configuration 测试里只给 Unix 测试用的
  Directory::write、lines、DEFAULTS 加 #[cfg(unix)]。
- CONTRIBUTING 的本地 Windows clippy 命令同样加上这个变量。
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 22, 2026 05:29
@xiaoyumuxi
xiaoyumuxi merged commit 1f05cfe into main Nov 22, 2026
11 of 14 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