diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3413f23 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + push: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: cargo test + clippy + fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt, clippy + - run: cargo fmt --all -- --check + - run: cargo clippy --workspace --all-targets -- -D warnings + - run: cargo test --workspace diff --git a/bno085/src/runtime.rs b/bno085/src/runtime.rs index 7502718..76ac12b 100644 --- a/bno085/src/runtime.rs +++ b/bno085/src/runtime.rs @@ -1,16 +1,16 @@ use std::time::Duration; use anyhow::{Result, bail}; -use phoxal_infra_bus::pubsub::Stamped; -use phoxal_core_component::v1::CapabilityRef; -use phoxal_core_component::v1::capability::Capability; use phoxal_api_component::v1::capability::accelerometer::Sample as AccelerometerSample; use phoxal_api_component::v1::capability::gyroscope::Sample as GyroscopeSample; use phoxal_api_component::v1::capability::imu; use phoxal_api_component::v1::capability::imu::Sample as ImuSample; +use phoxal_core_component::v1::CapabilityRef; +use phoxal_core_component::v1::capability::Capability; use phoxal_core_engine::clock::{Schedule, SchedulePolicy, Step}; use phoxal_core_engine::step::{Io, Publisher, Runtime, RuntimeInputs}; use phoxal_core_engine::{EmptyArgs, RobotRuntimeArgs}; +use phoxal_infra_bus::pubsub::Stamped; #[derive(Clone)] pub struct Config { @@ -20,7 +20,10 @@ pub struct Config { } impl Config { - pub fn new(component_id: &str, component: &phoxal_core_component::v1::Component) -> Result { + pub fn new( + component_id: &str, + component: &phoxal_core_component::v1::Component, + ) -> Result { Ok(Self { imu: sensor(component_id, component, CapabilityKind::Imu)?, accelerometer: sensor(component_id, component, CapabilityKind::Accelerometer)?, diff --git a/ddsm115/src/runtime.rs b/ddsm115/src/runtime.rs index d430602..97fe8c9 100644 --- a/ddsm115/src/runtime.rs +++ b/ddsm115/src/runtime.rs @@ -1,15 +1,15 @@ use std::time::Duration; use anyhow::{Result, bail}; -use phoxal_infra_bus::pubsub::Stamped; -use phoxal_core_component::v1::CapabilityRef; -use phoxal_core_component::v1::capability::{Capability, MotorCommand}; use phoxal_api_component::v1::capability::encoder::Sample; use phoxal_api_component::v1::capability::motor::Command; use phoxal_api_component::v1::capability::{encoder, motor}; +use phoxal_core_component::v1::CapabilityRef; +use phoxal_core_component::v1::capability::{Capability, MotorCommand}; use phoxal_core_engine::clock::{Schedule, SchedulePolicy, Step}; use phoxal_core_engine::step::{Io, Publisher, Runtime, RuntimeInputs}; use phoxal_core_engine::{EmptyArgs, RobotRuntimeArgs}; +use phoxal_infra_bus::pubsub::Stamped; use tracing::info; #[derive(Clone)] @@ -20,7 +20,10 @@ pub struct Config { } impl Config { - pub fn new(component_id: &str, component: &phoxal_core_component::v1::Component) -> Result { + pub fn new( + component_id: &str, + component: &phoxal_core_component::v1::Component, + ) -> Result { let mut actuator_id = None; let mut actuator_type = None; let mut encoder = None; diff --git a/vl53l1x/src/runtime.rs b/vl53l1x/src/runtime.rs index 1ea25e5..a1aa8d6 100644 --- a/vl53l1x/src/runtime.rs +++ b/vl53l1x/src/runtime.rs @@ -1,11 +1,11 @@ use anyhow::{Result, bail}; -use phoxal_infra_bus::pubsub::Stamped; +use phoxal_api_component::v1::capability::range::{self, Sample}; use phoxal_core_component::v1::CapabilityRef; use phoxal_core_component::v1::capability::{Capability, Range as RangeConfig}; -use phoxal_api_component::v1::capability::range::{self, Sample}; use phoxal_core_engine::clock::{Schedule, SchedulePolicy, Step}; use phoxal_core_engine::step::{Io, Publisher, Runtime, RuntimeInputs}; use phoxal_core_engine::{EmptyArgs, RobotRuntimeArgs}; +use phoxal_infra_bus::pubsub::Stamped; #[derive(Clone)] pub struct Config { @@ -13,7 +13,10 @@ pub struct Config { } impl Config { - pub fn new(component_id: &str, component: &phoxal_core_component::v1::Component) -> Result { + pub fn new( + component_id: &str, + component: &phoxal_core_component::v1::Component, + ) -> Result { Ok(Self { range: Self::inspect(component_id, component)?, })