Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ with open('$f', 'w') as fh:
fi
fi

# 5. Run unit tests (if cargo is available)
if has_cmd cargo; then
cargo test --lib --no-default-features --quiet
else
echo "WARN: cargo not found — skipping unit tests (run 'just setup-local')"
# Detect staged source files for conditional test runs
STAGED_HOSTD=$(git diff --cached --name-only --diff-filter=d | grep '^hostd/' || true)
STAGED_LIB=$(git diff --cached --name-only --diff-filter=d | grep '^src/' || true)

# 5. Run unit tests when library sources change (if cargo is available)
if [ -n "$STAGED_LIB" ]; then
if has_cmd cargo; then
cargo test --lib --no-default-features --quiet
else
echo "WARN: cargo not found — skipping unit tests (run 'just setup-local')"
fi
fi

# 6. Run hostd tests (uses stable toolchain via hostd/rust-toolchain.toml)
if [ -n "$STAGED_HOSTD" ] || [ -n "$STAGED_LIB" ]; then
if has_cmd cargo && [ -f hostd/Cargo.toml ]; then
(cd hostd && cargo test --quiet)
fi
fi
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- run: cargo fmt --check
env:
RUSTUP_TOOLCHAIN: nightly
- run: cd hostd && cargo fmt --check
env:
RUSTUP_TOOLCHAIN: nightly

schemas:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -75,6 +78,28 @@ jobs:
run: cargo audit
env:
RUSTUP_TOOLCHAIN: nightly
- name: Audit hostd dependencies
run: cd hostd && cargo audit
env:
RUSTUP_TOOLCHAIN: nightly

hostd:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: dtolnay/rust-toolchain@0f1b44df7e9cbb178d781a242338dfa5e243ad7f # stable
with:
components: clippy
- name: Install BLE dev dependencies
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev
- name: Check
run: cd hostd && cargo check
- name: Clippy
run: cd hostd && cargo clippy -- -D warnings
- name: Test
run: cd hostd && cargo test

build:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/target
/firmware-std/target
/hostd/target
/hostd/AirHound.app
.embuild
.claude/

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ esp32s3 = [
# Board constants only (no firmware deps — usable by external crates)
board-xiao = []
board-m5stickc = []
board-host = []

# Board-level features (constants + firmware deps)
xiao = ["board-xiao", "esp32s3"]
Expand Down
Loading
Loading