diff --git a/src/build.rs b/src/build.rs index d0a4c8c4b..214cdc64a 100644 --- a/src/build.rs +++ b/src/build.rs @@ -266,19 +266,23 @@ pub async fn run_build( tracing::info!("{}", output); - tracing::info!("Running tests"); - - test::run_test( - &result, - &TestConfiguration { - test_prefix: test_dir.clone(), - target_platform: Some(output.build_configuration.target_platform), - keep_test_prefix: tool_configuration.no_clean, - channels, - }, - ) - .await - .into_diagnostic()?; + if tool_configuration.no_test { + tracing::info!("Skipping tests"); + } else { + tracing::info!("Running tests"); + + test::run_test( + &result, + &TestConfiguration { + test_prefix: test_dir.clone(), + target_platform: Some(output.build_configuration.target_platform), + keep_test_prefix: tool_configuration.no_clean, + channels, + }, + ) + .await + .into_diagnostic()?; + } if !tool_configuration.no_clean { fs::remove_dir_all(&directories.build_dir).into_diagnostic()?; diff --git a/src/main.rs b/src/main.rs index 29979ff62..20488fdcf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,6 +117,10 @@ struct BuildOpts { #[arg(long)] no_include_recipe: bool, + /// Do not run tests after building + #[arg(long, default_value = "false")] + no_test: bool, + #[clap(flatten)] common: CommonOpts, } @@ -134,6 +138,10 @@ struct RebuildOpts { #[arg(short, long)] package_file: PathBuf, + /// Do not run tests after building + #[arg(long, default_value = "false")] + no_test: bool, + #[clap(flatten)] common: CommonOpts, } @@ -279,6 +287,7 @@ async fn run_build_from_args(args: BuildOpts, multi_progress: MultiProgress) -> client: AuthenticatedClient::default(), multi_progress_indicator: multi_progress, no_clean: args.keep_build, + no_test: args.no_test, }; for (output, variants) in outputs_and_variants { @@ -392,6 +401,7 @@ async fn rebuild_from_args(args: RebuildOpts) -> miette::Result<()> { client: AuthenticatedClient::default(), multi_progress_indicator: MultiProgress::new(), no_clean: true, + no_test: args.no_test, }; output diff --git a/src/metadata.rs b/src/metadata.rs index b9ff56579..e73588317 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -183,7 +183,7 @@ pub struct BuildConfiguration { pub subpackages: BTreeMap, /// Package format (.tar.bz2 or .conda) pub package_format: ArchiveType, - /// Wether to store the recipe and build instructions in the final package or not + /// Whether to store the recipe and build instructions in the final package or not #[serde(skip_serializing, default = "default_true")] pub store_recipe: bool, } diff --git a/src/test.rs b/src/test.rs index c9e5d5f0b..fb1591332 100644 --- a/src/test.rs +++ b/src/test.rs @@ -301,6 +301,7 @@ pub async fn run_test(package_file: &Path, config: &TestConfiguration) -> Result client: AuthenticatedClient::default(), multi_progress_indicator: MultiProgress::new(), no_clean: config.keep_test_prefix, + no_test: false, }; println!("Creating test environment in {:?}", prefix); diff --git a/src/tool_configuration.rs b/src/tool_configuration.rs index ff6198dd9..be57d0474 100644 --- a/src/tool_configuration.rs +++ b/src/tool_configuration.rs @@ -16,6 +16,9 @@ pub struct Configuration { /// Set this to true if you want to keep the build folder after the build is done pub no_clean: bool, + + /// Whether to skip the test phase + pub no_test: bool, } impl Default for Configuration { @@ -33,6 +36,7 @@ impl Default for Configuration { ), ), no_clean: false, + no_test: false, } } }