ci: extend clippy to workspace-excluded tools; fix rtt-only import gates #149
Workflow file for this run
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # ------------------------------------------------------------------------- | |
| # Job 1: host — format, clippy, test on native target | |
| # ------------------------------------------------------------------------- | |
| host: | |
| name: Host (fmt + clippy + test) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Install system libudev (required by serialport on Linux) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libudev-dev pkg-config | |
| - name: Cache Cargo artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Clippy (warnings as errors) | |
| run: cargo clippy --workspace -- -D warnings | |
| - name: Clippy tools/telepath-shell (rtt feature) | |
| run: cargo clippy --manifest-path tools/telepath-shell/Cargo.toml --all-targets -- -D warnings | |
| - name: Clippy tools/telepath-shell (serial feature) | |
| run: cargo clippy --manifest-path tools/telepath-shell/Cargo.toml --no-default-features --features serial --all-targets -- -D warnings | |
| - name: Clippy tools/telepath-mcp-server (rtt feature) | |
| run: cargo clippy --manifest-path tools/telepath-mcp-server/Cargo.toml --all-targets -- -D warnings | |
| - name: Clippy tools/telepath-mcp-server (serial feature) | |
| run: cargo clippy --manifest-path tools/telepath-mcp-server/Cargo.toml --no-default-features --features serial --all-targets -- -D warnings | |
| - name: Run tests | |
| run: cargo test --workspace | |
| - name: Smoke test host-pty-server | |
| run: | | |
| cargo build -p host-pty-server | |
| cargo build --manifest-path tools/telepath-shell/Cargo.toml --no-default-features --features serial | |
| cargo run -p host-pty-server > /tmp/server.out & | |
| SERVER_PID=$! | |
| trap 'kill "$SERVER_PID" 2>/dev/null || true; wait "$SERVER_PID" 2>/dev/null || true' EXIT | |
| for i in $(seq 1 15); do | |
| SLAVE=$(grep 'HOST_PTY_SERVER_PATH=' /tmp/server.out 2>/dev/null | sed 's/HOST_PTY_SERVER_PATH=//' | head -1 || true) | |
| if [ -n "$SLAVE" ]; then break; fi | |
| sleep 1 | |
| done | |
| if [ -z "$SLAVE" ]; then | |
| echo "host-pty-server did not print PTY path within 15s" | |
| cat /tmp/server.out | |
| exit 1 | |
| fi | |
| tools/telepath-shell/target/debug/telepath-shell --port "$SLAVE" --exec ping | tee /tmp/shell.out | |
| grep -qF "ping -> 0xDEADBEEF" /tmp/shell.out | |
| - name: Test MCP server (workspace-excluded) | |
| working-directory: tools/telepath-mcp-server | |
| run: cargo test | |
| # ------------------------------------------------------------------------- | |
| # Job 2: firmware — cross-compile check + release build for nRF52840-DK | |
| # ------------------------------------------------------------------------- | |
| firmware: | |
| name: Firmware (cross-compile nRF52840-DK) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain with embedded target | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: thumbv7em-none-eabi | |
| - name: Cache Cargo artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check firmware (no linking) | |
| working-directory: examples/nrf52840-ping | |
| run: cargo check | |
| - name: Build firmware (release) | |
| working-directory: examples/nrf52840-ping | |
| run: cargo build --release |