Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the Simulation dependency on linux by making it a package #92

Closed
wants to merge 5 commits into from
Closed
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
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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/
2 changes: 1 addition & 1 deletion .github/workflows/calypso-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Create and publish Calypso docker image
on:
push:
branches: ['Develop']
path:
paths:
- "Dockerfile"
workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
98 changes: 56 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 5 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
[package]
name = "calypso"
version = "0.1.0"
edition = "2021"
rust-version = "1.79"
default-run = "calypso"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]
members = ["libs/daedalus", "libs/calypso-cangen"]
members = ["daedalus", "calypso-cangen", "calypso-simulate", "calypso"]
default-members = ["calypso"]
resolver = "2"

[workspace.dependencies]
proc-macro2 = "1.0.92"
quote = "1.0.37"
serde = { version = "1.0.216", features = ["derive"] }
serde_json = "1.0.134"


[dependencies]
socketcan = "3.3.1"
paho-mqtt = "0.12.5"
protobuf-codegen = "3.5.1"
protobuf = "3.5.1"
bitstream-io = "2.6.0"
clap = { version = "4.5.23", features = ["derive", "env"] }
rand = "0.8"
phf = { version = "0.11.2", features = ["macros"] }
calypso-cangen = { path = "./libs/calypso-cangen" }
daedalus = { path = "./libs/daedalus" }


[build-dependencies]
protobuf-codegen = "3.5.1"
calypso-cangen = { path = "./libs/calypso-cangen" }
protobuf = "3.5.1"

[profile.release]
lto = true
codegen-units = 1
panic = "abort"
panic = "abort"
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ COPY . .

RUN git submodule update --init
RUN apt-get update && apt-get install -y libssl-dev build-essential cmake
RUN cargo install --path .
RUN cargo build --all --release

FROM debian:bookworm-slim
RUN apt update
RUN apt install openssl -y
RUN apt-get update
RUN apt-get install openssl -y

COPY --from=builder /usr/local/cargo/bin/calypso /usr/local/bin/calypso
COPY --from=builder /usr/local/cargo/bin/simulate /usr/local/bin/simulate
COPY --from=builder /usr/src/calypso/target/release/calypso /usr/local/bin/calypso
COPY --from=builder /usr/src/calypso/target/release/calypso-simulate /usr/local/bin/calypso-simulate

CMD ["simulate"]
CMD ["calypso-simulate"]

# START WITH: sudo docker run -d --rm --network host calypso
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,11 @@ Now view calypso interpret the can message and broadcast it on `mqttui`

### Simulation Mode
#### Run from build
- Same setup as above, then use the entry point `simulate` instead of `main`
- ```cargo run --bin simulate```
- ```cargo run --bin simulate -- -u localhost:1883```
- Same setup as above, then use the package `calypso-simulate` instead of the default `calypso`.
- ```cargo run -p calypso-simulate```
- ```cargo run -p calypso-simulate -- -u localhost:1883```

#### 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
- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop```
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pub mod validate;
* Used by all daedalus macros
* Filepath is relative to project root (i.e. /Calypso)
*/
pub const CANGEN_SPEC_PATH: &str = "./Embedded-Base/cangen/can-messages";
pub const CANGEN_SPEC_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../Embedded-Base/cangen/can-messages");
File renamed without changes.
Loading
Loading