diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..abcf183 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +# editor things +.idea/ +.zed/ +.vscode/ + +# misc things +.DS_Store +.gitignore +*.nix + +# python things +pyrightconfig.json +__pycache__/ + +# Added by cargo (rust things) +/target +build/ +dist/ +logs/ + +# protobuf +mod.rs +command_data.rs +serverdata.rs + +# private testing +/privatetest/ diff --git a/.github/workflows/calypso-build.yml b/.github/workflows/calypso-build.yml index 62d53d7..02aea65 100644 --- a/.github/workflows/calypso-build.yml +++ b/.github/workflows/calypso-build.yml @@ -4,7 +4,7 @@ name: Create and publish Calypso docker image on: push: branches: ['Develop'] - path: + paths: - "Dockerfile" workflow_dispatch: diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 1ed8c62..76c6d4e 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -22,11 +22,11 @@ jobs: - name: Install cargo-audit run: cargo install cargo-audit - name: Build - run: cargo build --verbose + run: cargo build --all --verbose - name: Test run: cargo test --verbose - name: Fmt - run: cargo fmt --check + run: cargo fmt --all --check - name: Clippy run: cargo clippy --verbose --all -- -D warnings - name: Audit diff --git a/Cargo.toml b/Cargo.toml index 1c626d0..7b649d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ serde_json = "1.0.134" [dependencies] -socketcan = "3.3.1" paho-mqtt = "0.12.5" protobuf-codegen = "3.5.1" protobuf = "3.5.1" @@ -29,6 +28,9 @@ phf = { version = "0.11.2", features = ["macros"] } calypso-cangen = { path = "./libs/calypso-cangen" } daedalus = { path = "./libs/daedalus" } +[target.'cfg(target_os = "linux")'.dependencies] +socketcan = { version = "3.3.1" } + [build-dependencies] protobuf-codegen = "3.5.1" diff --git a/README.md b/README.md index 5a394e7..b68d7b5 100644 --- a/README.md +++ b/README.md @@ -48,22 +48,4 @@ Now view calypso interpret the can message and broadcast it on `mqttui` #### Run from Docker - ```docker pull ghcr.io/northeastern-electric-racing/calypso:Develop``` - ```docker run -d --rm --network host ghcr.io/northeastern-electric-racing/calypso:Develop``` -- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop``` - - - -### Generate Proto - -#### linux -`apt-get install protobuf-compiler -y` - -#### mac -`brew install protobuf` - -`cargo install protobuf-codegen` - -`PATH="$HOME/.cargo/bin:$PATH"` - -`protoc --rust_out ./src ./src/proto/serverdata.proto` - -delete the `mod.rs` file \ No newline at end of file +- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop``` \ No newline at end of file diff --git a/build.rs b/build.rs index 68b482c..3e30810 100644 --- a/build.rs +++ b/build.rs @@ -4,6 +4,7 @@ use std::process; /* Prebuild script */ fn main() { println!("cargo:rerun-if-changed=Embedded-Base"); + println!("cargo:rerun-if-changed=src/proto"); protobuf_codegen::Codegen::new() .pure() @@ -13,7 +14,7 @@ fn main() { .input("src/proto/command_data.proto") .input("src/proto/serverdata.proto") // Specify output directory relative to Cargo output directory. - .out_dir("src") + .out_dir("src/proto") .run_from_script(); // Validate CAN spec diff --git a/src/bin/simulate.rs b/src/bin/simulate.rs index 2a4c716..a60305e 100644 --- a/src/bin/simulate.rs +++ b/src/bin/simulate.rs @@ -3,9 +3,9 @@ use std::{ time::{Duration, UNIX_EPOCH}, }; +use calypso::proto::serverdata; use calypso::{ - mqtt::MqttClient, serverdata, simulatable_message::SimShared, - simulate_data::create_simulated_components, + mqtt::MqttClient, simulatable_message::SimShared, simulate_data::create_simulated_components, }; use clap::Parser; diff --git a/src/lib.rs b/src/lib.rs index 76ef74e..c4d2875 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,7 @@ -pub mod command_data; pub mod data; pub mod decode_data; pub mod encode_data; pub mod mqtt; -pub mod serverdata; +pub mod proto; pub mod simulatable_message; pub mod simulate_data; diff --git a/src/main.rs b/src/main.rs index 21ef2ee..c119e2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,8 @@ use std::{ }; use calypso::{ - command_data, data::DecodeData, data::EncodeData, decode_data::*, encode_data::*, - mqtt::MqttClient, serverdata, + data::DecodeData, data::EncodeData, decode_data::*, encode_data::*, mqtt::MqttClient, + proto::command_data, proto::serverdata, }; use clap::Parser; use protobuf::Message;