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

Add skip build option to cairo-test #1301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions extensions/scarb-cairo-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ struct Args {
/// Whether to print resource usage after each test.
#[arg(long, default_value_t = false)]
print_resource_usage: bool,

/// Do not rebuild the package.
#[arg(long, default_value_t = false)]
no_build: bool,
maciektr marked this conversation as resolved.
Show resolved Hide resolved
}

fn main() -> Result<()> {
Expand All @@ -42,13 +46,15 @@ fn main() -> Result<()> {
check_scarb_version(&metadata);

let matched = args.packages_filter.match_many(&metadata)?;
let filter = PackagesFilter::generate_for::<Metadata>(matched.iter());

ScarbCommand::new()
.arg("build")
.arg("--test")
.env("SCARB_PACKAGES_FILTER", filter.to_env())
.run()?;
if !args.no_build {
let filter = PackagesFilter::generate_for::<Metadata>(matched.iter());
ScarbCommand::new()
.arg("build")
.arg("--test")
.env("SCARB_PACKAGES_FILTER", filter.to_env())
.run()?;
}

let profile = env::var("SCARB_PROFILE").unwrap_or("dev".into());
let default_target_dir = metadata.runtime_manifest.join("target");
Expand Down