Open
Description
A few subtle Cargo behaviors mean that we don't run what we think we run in CI:
- It turns out that if you have a "main package" in a workspace (which we do), then commands like
cargo build
andcargo test
apply to the main package, not all workspace members. cargo build
only builds the "default" targetslib
andbin
. It doesn't buildtest
,example
, andbench
targets unless you also pass the--all-targets
flag.cargo test --examples
does not actually run the examples. It only runs the tests defined in the examples.
As I recall, the last one is intentional. The issue is that there is no Cargo command to run all examples automatically. There is a bit of bash code involving jq
that can gather all example names and run them, but in our case one of the examples intentionally requires a command line argument, and instead of dealing with the complexity we decided at the time that it was enough just to build the examples and run their tests. Here's a complete list of commands to run all examples:
cargo run --example basic
cargo run --example basic-infection
cargo run --example births-deaths
cargo run --example load-people
cargo run --example network-hhmodel
cargo run --example parameter-loading
cargo run --example random
cargo run --example reports
cargo run --example reports-multi-threaded
cargo run --example runner
cargo run --example time-varying-infection -- examples/time-varying-infection/input.json
Metadata
Metadata
Assignees
Labels
No labels