refactor: 重构架构并整理仓库

This commit is contained in:
Horldsence
2026-09-23 10:56:57 +08:00
parent 680adae339
commit f8aeafdfc2
101 changed files with 14417 additions and 11399 deletions
+20 -49
View File
@@ -10,7 +10,6 @@ env:
jobs:
lint-and-test:
name: fmt / clippy / test / doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -18,58 +17,47 @@ jobs:
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: test
run: cargo test --workspace
- name: doc
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --no-deps
# 整定工具的可选 feature 不在默认 clippy/test 里,单独编译一次防止腐烂。
- name: chassis-tune plot feature
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets -- -D warnings
- run: cargo test --workspace --all-targets
- name: enforce flat crate source
run: test -z "$(find crates/*/src -mindepth 2 -type d -print)"
- name: forbid unsafe and no_std markers
run: "! rg '\\bunsafe\\b|libc|no_std' crates Cargo.toml -g '*.rs' -g '*.toml'"
- name: optional plot feature
run: cargo check -p chassis-tune --features plot --all-targets
# 自动整定的确定性冒烟:同 seed 必须逐位一致,且最优解必须通过验收阈值。
- name: tune smoke (deterministic, no hardware)
- name: deterministic tuning smoke
run: |
cargo run --release -p chassis-tune -- sweep \
--samples 64 --top-k 3 --max-iters 40 --ensemble 2 --seed 7 \
--out-dir target/tune-smoke
cargo run --release -p chassis-tune -- sweep \
--samples 64 --top-k 3 --max-iters 40 --ensemble 2 --seed 7 \
--out-dir target/tune-smoke-again
cargo run --release -p chassis-tune -- sweep --samples 64 --top-k 3 --max-iters 40 --ensemble 2 --seed 7 --out-dir target/tune-smoke
cargo run --release -p chassis-tune -- sweep --samples 64 --top-k 3 --max-iters 40 --ensemble 2 --seed 7 --out-dir target/tune-smoke-again
diff target/tune-smoke/trials.csv target/tune-smoke-again/trials.csv
vcan-integration:
name: vcan0 integration (real kernel CAN stack)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: set up vcan0
run: |
- run: |
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
- name: run vcan tests
run: cargo test -p dji-esc-socketcan -- --ignored --test-threads 1
- run: cargo test -p socketcan@0.1.0 --test vcan -- --ignored --test-threads 1
cross-aarch64:
name: cross check aarch64
cross-check:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-musleabihf]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --target aarch64-unknown-linux-gnu
- run: cargo check --workspace --target ${{ matrix.target }}
build-armv7:
name: build armv7 static (board target)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -77,21 +65,4 @@ jobs:
with:
targets: armv7-unknown-linux-musleabihf
- uses: Swatinem/rust-cache@v2
- run: cargo build --release -p chassisd --target armv7-unknown-linux-musleabihf
# 台架工具与整定工具同样要在板端跑(真机后端常直接跑在 T153 上)。
- run: cargo build --release -p chassis-bench --bin chassis-spin --target armv7-unknown-linux-musleabihf
- run: cargo build --release -p chassis-tune --target armv7-unknown-linux-musleabihf
coverage:
name: coverage (llvm-cov)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- uses: actions/upload-artifact@v4
with:
name: coverage-lcov
path: lcov.info
- run: cargo build --release -p chassisd -p spin -p chassis-tune --target armv7-unknown-linux-musleabihf