1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: NuttX target check
# Pinned to nightly-2026-02-01 + a sysroot patch (ci/patch-nuttx-libstd.sh)
# because tier-3 riscv32imac-unknown-nuttx-elf needs -Zbuild-std, and that
# nightly's libstd references libc::_SC_HOST_NAME_MAX for nuttx while the
# libc it pins lacks the constant. `[patch.crates-io] libc` can't fix it
# (-Zbuild-std resolves the std workspace separately, rust-lang/cargo#9424).
# Temporary: drop the pin + patch step once a clean nightly compiles
# libstd for nuttx without sysroot edits.
on:
push:
branches:
paths:
- "src/surface/nuttx/**"
- "src/surface/scale.rs"
- "src/surface/input_state.rs"
- "src/surface/mod.rs"
- "Cargo.toml"
- ".github/workflows/nuttx-check.yml"
- "ci/patch-nuttx-libstd.sh"
pull_request:
branches:
paths:
- "src/surface/nuttx/**"
- "src/surface/scale.rs"
- "src/surface/input_state.rs"
- "src/surface/mod.rs"
- "Cargo.toml"
- ".github/workflows/nuttx-check.yml"
- "ci/patch-nuttx-libstd.sh"
env:
CARGO_TERM_COLOR: always
jobs:
nuttx-check:
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: nightly-2026-02-01
steps:
- uses: actions/checkout@v4
- name: Install pinned nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-02-01
# rust-src via a separate `rustup component add`: installing it
# through dtolnay's `--component` registers it per-arch and
# -Zbuild-std can't find library/Cargo.lock (rustup#2601).
- name: Add rust-src to pinned nightly
run: rustup component add rust-src --toolchain nightly-2026-02-01
- name: Verify rust-src is materialized
run: test -f "$(rustc +nightly-2026-02-01 --print sysroot)/lib/rustlib/src/rust/library/Cargo.lock"
- name: Patch sysroot libstd for nuttx target
run: ci/patch-nuttx-libstd.sh nightly-2026-02-01
- uses: Swatinem/rust-cache@v2
with:
# Suffix busts the cache when the patch changes — rust-cache's
# auto key doesn't hash the sysroot or the patch, so a stale
# target/ built against unpatched libstd would otherwise be
# reused. Bump the version when the patch changes.
key: nuttx-patched-v1
- name: cargo check riscv32imac-unknown-nuttx-elf
# NuttX is rustc tier-3 — `riscv32imac-unknown-nuttx-elf` ships
# no prebuilt artifacts, so `-Zbuild-std` rebuilds libstd from
# source. `feature = "nuttx"` pulls in `std` (libc syscalls
# `open`/`ioctl`/`read`/`close` go through `std::io::Result`),
# so the build-std set has to include `std` and `panic_abort`
# (NuttX target spec mandates `panic = abort`).
run: |
cargo +nightly-2026-02-01 check \
--target riscv32imac-unknown-nuttx-elf \
--no-default-features \
--features nuttx \
-Zbuild-std=std,panic_abort \
--lib