Skip to content

Commit

Permalink
Use cargo workspaces for our multiple crates
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Guggi committed Aug 4, 2024
1 parent b5f670b commit b3dc4a7
Show file tree
Hide file tree
Showing 47 changed files with 53 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
cross build --examples --bins --release --target aarch64-unknown-linux-gnu
mv target/aarch64-unknown-linux-gnu/release/STS1_EDU_Scheduler .
mv target/aarch64-unknown-linux-gnu/release/examples/cli .
cp scheduler/config.toml .
cp scheduler/scheduler.service .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ __pycache__/
venv
.vscode
log
archives/
data/
archives/*
data/*
tests/tmp/
lib/**/target

# Added by cargo

/target
/target
40 changes: 8 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
[package]
name = "STS1_EDU_Scheduler"
version = "0.1.0"
edition = "2021"

[dependencies]
log = "0.4.22"
simplelog = "0.12.2"
subprocess = "0.2.9"
crc = "3.2.1"
toml = "0.8.19"
rppal = "0.18.0"
serde = { version = "1.0.204", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] }
serialport = "4.4.0"
test-case = "3.3.1"
tar = "0.4.41"
thiserror = "1.0.63"
anyhow = { version = "1.0.86", features = ["backtrace"] }

[dependencies.filevec]
path = "lib/filevec"

[features]
mock = []
rpi = []

[dev-dependencies]
file-per-thread-logger = "0.2.0"
inquire = "0.7.5"

[lints.clippy]
[workspace]
resolver = "2"
members = [
"scheduler",
"filevec",
]

[workspace.lints.clippy]
pedantic = { level = "warn", priority = -1 }
missing_errors_doc = "allow"
module_name_repetitions = "allow"
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ packs:

clean:
rm -rf *.profraw
rm -f ThreadId* updatepin
rm -f data/*
rm -rf archives/*
rm -rf tests/tmp
rm -f tests/*.pack
rm -f scheduler/ThreadId* scheduler/updatepin
rm -f scheduler/data/*
rm -rf scheduler/archives/*
rm -rf scheduler/tests/tmp
rm -f scheduler/tests/*.pack

rebuild_student_archive:
rm -f tests/student_program.zip
Expand Down
2 changes: 0 additions & 2 deletions archives/.gitkeep
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
Folder for storing student programs
Used by tests
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions scheduler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "STS1_EDU_Scheduler"
version = "0.1.0"
edition = "2021"

[dependencies]
log = "0.4.22"
simplelog = "0.12.2"
subprocess = "0.2.9"
crc = "3.2.1"
toml = "0.8.19"
rppal = "0.18.0"
serde = { version = "1.0.204", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] }
serialport = "4.4.0"
test-case = "3.3.1"
tar = "0.4.41"
thiserror = "1.0.63"
anyhow = { version = "1.0.86", features = ["backtrace"] }

[dependencies.filevec]
path = "../filevec"

[features]
mock = []
rpi = []

[dev-dependencies]
file-per-thread-logger = "0.2.0"
inquire = "0.7.5"

[lints]
workspace = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn start_scheduler(
std::io::Error,
> {
let test_dir = format!("./tests/tmp/{unique}");
let scheduler_bin = std::fs::canonicalize("./target/release/STS1_EDU_Scheduler")?;
let scheduler_bin = std::fs::canonicalize("../target/release/STS1_EDU_Scheduler")?;
let _ = std::fs::remove_dir_all(&test_dir);
std::fs::create_dir_all(&test_dir)?;
std::fs::write(format!("{}/config.toml", &test_dir), get_config_str(unique))?;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Write for TestCom {
/// Copy the mockup student program from `tests/test_data/main.py` into `archives/{path}`. This absolves the need
/// to include an extra `store_archive` command.
pub fn prepare_program(path: &str) {
let ret = std::fs::create_dir(format!("./archives/{path}"));
let ret = std::fs::create_dir_all(format!("./archives/{path}"));
if let Err(e) = ret {
assert!(e.kind() == std::io::ErrorKind::AlreadyExists, "Setup Error: {e}");
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b3dc4a7

Please sign in to comment.