Repository navigation
ci: gate the musl and OpenHarmony targets - #210
Merged
Merged
Conversation
Member
Author
|
配套 PR:unixwin/rubash#449 — 本地实测(按这个 job 的逻辑跑的)rubash 用 #449 的版本,niubash 用当前 master:
修前的报错就是 合并顺序#449 先落地,这个 PR 才会绿。 在那之前 |
`cross-check` runs on ubuntu-latest and macos-latest, which are both x86_64/glibc. Nothing covers musl, and nothing covers aarch64 at all, so whole classes of libc and arch divergence are invisible to CI. That is not hypothetical. rubash's `ulimit` typed its resource selector as `libc::__rlimit_resource_t`, a typedef only glibc defines. musl and the OpenHarmony libc take a plain `c_int`, so both targets failed with two `cannot find type` errors each -- while `cross-check` stayed green, because the host is glibc and the cfg guard was `target_os = "linux"`, which ohos satisfies (`target_env = "ohos"`, not `"gnu"`). Add a `cross-target-check` job that `cargo check --workspace` for an explicit target: x86_64-unknown-linux-musl - the musl libc, and the static/Alpine story aarch64-unknown-linux-ohos - HarmonyOS PC `aarch64-unknown-linux-ohos` is Tier 2 with host tools, so a check-only build needs no OpenHarmony SDK or clang wrapper; `setup-rust-toolchain`'s `target:` input is enough. Both targets are unix, so the sibling rubash checkout and the `[patch]` override behave exactly as in the other jobs -- in particular no `cargo update -p rubash`, same reasoning as the comment already carried by `build-and-test` and `cross-check`. Depends on unixwin/rubash#449 (merged as 2b9c437), which is the fix that makes ohos clean.
caomengxuan666
force-pushed
the
ci/cross-target-check
branch
from
October 9, 2026 10:07
818f562 to
ad4d382
Compare
This was referenced Oct 9, 2026
This was referenced Oct 10, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 12, 2026
…l return + build.rs host-agnostic icon gate (#281) * fix(highlighting): color REPL-only commands (self-update, update-niubash, logout) as builtins (niu#260) self-update / update-niubash are intercepted by the REPL before engine command resolution, so they never resolve on PATH and the highlighter painted them as unknown tokens (red) even though they run fine (issue screenshot: red 'self-update' at the prompt). Same class of problem for 'logout', which is also a REPL-exact-match word. Add repl::is_repl_reserved_command as the shared predicate over REPL- reserved first words (exit, logout, self-update, update-niubash) and consult it from the highlighter's command-position classification, so these words get builtin styling instead of UnknownToken. Case-sensitive by design, matching the REPL's exact-match intercepts; argument positions are unaffected. Tests: highlighter repaints the three words as Builtin, argument position stays Default, predicate unit test covers exact-match semantics. * ci: gate the aarch64-linux-android and armv7-linux-androideabi cross-checks (niu#207 step 1) rubash#456 landed the bionic cfg fixes, so both android targets now check clean through rubash; this exposes them on the niubash side of the workspace check, same shape as the musl/ohos legs (#210/#221). Both targets verified green locally: cargo check --workspace --locked --target aarch64-linux-android and --target armv7-linux-androideabi. Two blockers surfaced and are fixed here: - arboard 3.6.1 (via reedline's system_clipboard feature) has no android backend and fails to compile for android targets. Gate the feature to non-android targets in Cargo.toml: Windows/macOS/Linux builds keep the system clipboard (arboard stays in their graphs), android loses Ctrl+V system paste behind a stub add_system_clipboard_keybindings, bracketed paste unaffected. - build.rs gated the icon .res embedding on #[cfg(windows)] - a HOST predicate. Cross-checking an android target from a Windows dev box made it run the SDK's arm64 rc.exe, an arm64 binary that cannot launch on x64 (os error 216). Gate on CARGO_CFG_TARGET_OS instead; the resource only links into PE binaries anyway. Ubuntu-hosted CI legs are unaffected either way. Part of niubash#207 (platform roadmap) step 1/2: make the compile surface visible and honest. Android remains compile-verified only - no release artifacts until a native smoke gate exists per docs/release.md red line. * fix(main): rc-0 one-shot exits return from main so the history session-end write runs Pre-existing master red (host_contract::history_and_fc_use_the_host_history_provider, failing on CI since 130598a): a one-shot 'niu -c history -c' left the history file holding the pre-clear list instead of truncating it. Root cause: 130598a routed every one-shot exit through finish_one_shot -> piped_stdout::finish_and_exit -> std::process::exit, which skips Rust destructors. RubashHistoryProvider::drop is the only thing that carries a GNU 'history -c' to the file at session end (niubash#265), so rc-0 -c sessions stopped flushing. 484dad3 (the original fast path) returned Ok(()) on rc 0 and only diverged on nonzero codes - the Drop ran and the test passed. finish_one_shot now calls piped_stdout::finish() and exits only on nonzero codes; rc 0 returns to the caller. Arms that previously relied on the always-diverging call tail now 'return Ok(())' explicitly so they cannot fall through into the script/REPL arms. Verified: the manual -c sequence (history; fc 2 / -s / -d 2 / -c) ends with an empty history file; 'exit 5' still propagates rc 5; host_contract and cwd_state suites green; cwd-state recording (the #272 feature) still runs before both exit forms. * fix(build): compile embed_windows_icon on every host - the call site is runtime-gated on the target OS 3ea224e (#207 step 1) moved the call site from host #[cfg(windows)] to a CARGO_CFG_TARGET_OS runtime check so a Windows host cross-checking an android target no longer runs the SDK's arm64 rc.exe (os error 216), but left the definition behind #[cfg(windows)]. On a linux/macOS host the call site now compiles while the definition is cfg'd out: E0425 on every non-Windows host (ubuntu/macos/android/ohos/armv7 cross-checks). Drop the cfg from the definition - it is std-only and dead unless the target is Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
cross-check跑在ubuntu-latest和macos-latest上,这俩都是 x86_64 + glibc。musl 完全没人测,aarch64 一个都没有。 所以整类 libc 差异、整类架构差异,CI 是瞎的。这不是假设,是刚发生的事:rubash 的
ulimit把资源选择器写成了libc::__rlimit_resource_t——只有 glibc 有这个名字。musl 和 OpenHarmony libc 收的是裸c_int,于是两个目标各自炸 2 处cannot find type,而cross-check一路绿灯。原因也简单:宿主是 glibc,而那层 cfg 守卫写的是target_os = "linux"——ohos 恰好满足(它的target_env是"ohos"而不是"gnu"),于是走进函数体然后找不到类型。改动
加一个
cross-target-checkjob,对显式 target 跑cargo check --workspace:选这两个的理由:
x86_64-unknown-linux-muslaarch64-unknown-linux-ohosaarch64-unknown-linux-ohos是 Tier 2 with host tools,所以 check-only 构建不需要 OpenHarmony SDK,也不需要 clang wrapper,setup-rust-toolchain的target:入参就够了。两个 target 都是 unix,所以 rubash 兄弟检出和
[patch]override 的行为跟其他 job 完全一致——照旧不做cargo update -p rubash,理由跟build-and-test/cross-check里已有的那段注释一样。验证
本地按这个 job 的逻辑实测过(rubash 用配套修复的 unixwin/rubash#449):
aarch64-unknown-linux-ohosx86_64-unknown-linux-musl修后两次都是
Finished dev profile ... target(s) in 32~55s,niubash v1.3.4和niubash-runtime v1.3.4都过。顺带说一句:这是 niubash 本体第一次被证明能在
aarch64-unknown-linux-ohos上编译通过,之前只验到 rubash 那一层。依赖
配套 PR:unixwin/rubash#449,那个补丁才是让 ohos 变绿的修复。这个 CI job 只有在 #449 落地之后才会绿——在那之前它会红,这正是它存在的意义。
改动纯增量:
.github/workflows/ci.yml+37 行,不动任何现有 job。