CI: Rust on the dev Orin (l4t-rust): clippy -D warnings, test, build, glibc; fix 4 clippy lints
/ crosscheck (push) Successful in 1s
Rust (L4T) / Clippy, test, build, glibc (push) Successful in 49s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
2026-10-13 19:09:33 +09:00
parent 00e8cf9e4e
commit 5cfa4fbb64
3 changed files with 72 additions and 5 deletions
+64
View File
@@ -0,0 +1,64 @@
name: Rust (L4T)
on:
push:
branches: [ master ]
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'scripts/check-glibc.sh'
- '.gitea/workflows/rust.yml'
pull_request:
branches: [ master ]
workflow_dispatch:
# Built natively on the development Orin (runner mikkeli-orin-nano-2-yukart, host mode,
# label l4t-rust): the car Orin's own L4T userland, so the glibc check below proves the
# binaries load there (project-yukart docs/REPOS.md). Plain git, no JavaScript actions:
# every yukart repo is public, and this repo needs contracts beside it (include_str!).
jobs:
build:
name: Clippy, test, build, glibc
runs-on: l4t-rust
steps:
- name: Checkout, with contracts beside it
env:
SERVER: ${{ gitea.server_url }}
REPO: ${{ github.event.repository.name }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
rm -rf ws && mkdir ws
git clone -q --depth 1 "$SERVER/yukart/contracts.git" ws/contracts
git init -q "ws/$REPO"
git -C "ws/$REPO" fetch -q --depth 1 "$SERVER/yukart/$REPO.git" "$SHA"
git -C "ws/$REPO" checkout -q FETCH_HEAD
echo "$REPO $(git -C ws/$REPO log --oneline -1); contracts $(git -C ws/contracts log --oneline -1)"
rustc --version; head -1 /etc/nv_tegra_release; ldd --version | sed -n 1p
# Kept between runs, in the runner's own home: a cold release build is minutes on the Orin.
echo "CARGO_TARGET_DIR=$HOME/target/$REPO" >> "$GITHUB_ENV"
- name: Clippy
working-directory: ws/${{ github.event.repository.name }}
run: cargo clippy --release --all-targets --locked -- -D warnings
- name: Test
working-directory: ws/${{ github.event.repository.name }}
run: cargo test --release --locked
- name: Build
working-directory: ws/${{ github.event.repository.name }}
run: cargo build --release --locked
- name: glibc ceiling (the car Orin's 2.35)
working-directory: ws/${{ github.event.repository.name }}
run: |
set -euo pipefail
bins=$(cargo metadata --format-version 1 --no-deps | python3 -c '
import json, sys
for p in json.load(sys.stdin)["packages"]:
for t in p["targets"]:
if "bin" in t["kind"]: print(t["name"])')
for b in $bins; do scripts/check-glibc.sh "$CARGO_TARGET_DIR/release/$b"; done
+6 -2
View File
@@ -242,7 +242,9 @@ fn decode(p: &[u8], now: i64) -> Option<(u64, u32, Vec<i64>)> {
return None;
}
let lat = p[HEADER..]
.chunks_exact(FRAME)
.as_chunks::<FRAME>()
.0
.iter()
.map(|f| now - i64::from_le_bytes(f[0..8].try_into().unwrap()))
.collect();
Some((seq, count, lat))
@@ -253,7 +255,9 @@ fn frames(p: &[u8]) -> Option<Vec<(i64, u32, Vec<u8>)>> {
decode(p, 0)?;
Some(
p[HEADER..]
.chunks_exact(FRAME)
.as_chunks::<FRAME>()
.0
.iter()
.map(|f| {
let len = (f[12] as usize).min(8);
(i64::from_le_bytes(f[0..8].try_into().unwrap()), u32::from_le_bytes(f[8..12].try_into().unwrap()), f[16..16 + len].to_vec())
+2 -3
View File
@@ -112,7 +112,7 @@ impl Poller {
let Some(r) = self.sock.recv(left)? else { return Ok(None) };
// Single frame: [length, 0x41, pid, A, B, ...]. Anything else is not our answer.
let len = (r.data[0] & 0x0F) as usize;
if r.data[0] >> 4 == 0 && len >= 2 && len <= 7 && r.data[1] == 0x41 && r.data[2] == pid {
if r.data[0] >> 4 == 0 && (2..=7).contains(&len) && r.data[1] == 0x41 && r.data[2] == pid {
return Ok(Some((r.ts_us, r.id, r.data[3..1 + len].to_vec())));
}
}
@@ -122,8 +122,7 @@ impl Poller {
fn discover(&self) -> std::io::Result<Vec<u8>> {
let mut all = Vec::new();
let mut mask = 0x00u8;
loop {
let Some((_, _, d)) = self.ask(mask)? else { break };
while let Some((_, _, d)) = self.ask(mask)? {
if d.len() < 4 {
break;
}