diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2a73291..52535ce 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -83,7 +83,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#zome_call_single_value -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -93,7 +93,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#single_write_many_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -103,7 +103,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#dht_sync_lag -- --connection-string ws://localhost:8888 --agents 2 --behaviour write:1 --behaviour record_lag:1 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -113,7 +113,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#app_install -- --connection-string ws://localhost:8888 --agents 2 --behaviour minimal:1 --behaviour large:1 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -123,7 +123,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#first_call -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -133,7 +133,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#write_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -143,7 +143,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#write_query -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -153,7 +153,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#local_signals -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -163,7 +163,7 @@ jobs: # Start a sandbox conductor and run it in the background nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &" - # Run the scenario for 5 seconds + # Run the scenario RUST_LOG=info nix run .#write_validated -- --connection-string ws://localhost:8888 --duration 5 --no-progress pkill hc && pkill holochain && pkill lair-keystore @@ -177,7 +177,7 @@ jobs: # Start a TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" - # Run the scenario for 30 seconds + # Run the scenario RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#trycp_write_validated -- --targets targets-ci.yaml --instances-per-target 2 --duration 30 --no-progress # Stop the TryCP instance @@ -194,8 +194,8 @@ jobs: # Start a TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" - # Run the scenario for 30 seconds - RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#remote_call_rate -- --targets targets-ci.yaml --instances-per-target 2 --duration 30 --no-progress + # Run the scenario + RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#remote_call_rate -- --targets targets-ci.yaml --instances-per-target 2 --duration 45 --no-progress # Stop the TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp" @@ -209,7 +209,7 @@ jobs: # Start a TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" - # Run the scenario for 30 seconds + # Run the scenario RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#two_party_countersigning -- --targets targets-ci.yaml --behaviour initiate:1 --behaviour participate:1 --instances-per-target 2 --duration 30 --no-progress # Stop the TryCP instance @@ -226,8 +226,8 @@ jobs: # Start a TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" - # Run the scenario for 30 seconds - RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#validation_receipts -- --targets targets-ci.yaml --instances-per-target 2 --duration 30 --no-progress + # Run the scenario + RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#validation_receipts -- --targets targets-ci.yaml --instances-per-target 2 --duration 45 --no-progress # Stop the TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp" @@ -243,7 +243,7 @@ jobs: # Start a TryCP instance nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" - # Run the scenario for 30 seconds + # Run the scenario RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#remote_signals -- --targets targets-ci.yaml --instances-per-target 2 --duration 30 --no-progress # Stop the TryCP instance diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c63f7..b3b2fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 we will separate those parts out and publish them as a crate. For now, this is private to the project. - `run_with_required_agents` function for TryCP scenarios that fails if the number of agents that completed the scenario is less than the passed `min_required_agents`. Can be overridden with the `MIN_REQUIRED_AGENTS` environment variable. +- Check that the scenarios have a cargo package name that matches the directory name used by Nix packages. Panic when + building the scenario if they do not match. [#122](https://github.com/holochain/wind-tunnel/pull/122) ### Changed - Updated to new Holochain client version 0.5.0-alpha.4 which allowed `&mut self` to be replaced with `&self` in admin diff --git a/nix/modules/rust.nix b/nix/modules/rust.nix index e1ad1ab..a9abd41 100644 --- a/nix/modules/rust.nix +++ b/nix/modules/rust.nix @@ -12,7 +12,7 @@ let rustWithWasmTarget = rustPkgs.rust-bin.stable."${rustVersion}".minimal.override { targets = [ "wasm32-unknown-unknown" ]; - extensions = [ "clippy" ]; + extensions = [ "clippy" "rustfmt" ]; }; craneLib = (crane.mkLib rustPkgs).overrideToolchain rustWithWasmTarget; diff --git a/scenarios/scenario_build.rs b/scenarios/scenario_build.rs index 6082242..38270d0 100644 --- a/scenarios/scenario_build.rs +++ b/scenarios/scenario_build.rs @@ -1,9 +1,22 @@ use happ_builder::{build_happs, required_tools_available, BuildOptions, HappBuilderResult}; +use std::{path::PathBuf, str::FromStr}; /// Build the required DNA(s) and hApps for the scenario. /// The built DNA(s) will appear as `/dnas//.dna` from the project root. -/// /// The built hApp(s) will appear as `/happs//.happ` from the project root. +/// The built hApp(s) will appear as `/happs//.happ` from the project root. fn main() -> HappBuilderResult { + let scenario_dir = PathBuf::from_str(std::env!("CARGO_MANIFEST_DIR")).unwrap(); + let dir_name = scenario_dir.file_name().unwrap().to_str().unwrap(); + let package_name = std::env!("CARGO_PKG_NAME"); + if package_name != dir_name { + // The directory name is used as the Nix package name which is in turn used with `cargo run` + // inside the Nix package. Therefore, panic during the build if the directory name does not + // match the package name. + panic!( + "The package name of the scenario '{package_name}' does not match the directory name '{dir_name}'", + ); + } + println!("cargo:rerun-if-env-changed=SKIP_HAPP_BUILD"); if std::env::var("SKIP_HAPP_BUILD").is_ok() { return Ok(());