fix(xtask): run verification from workspace root
This commit is contained in:
+15
-2
@@ -1365,7 +1365,7 @@ impl Step {
|
||||
fn run(&self, budget: &Budget) -> Result<(), ExitCode> {
|
||||
eprintln!("\n==> {}", self.name);
|
||||
let mut command = Command::new(self.tool);
|
||||
command.args(&self.args);
|
||||
command.current_dir(workspace_root()).args(&self.args);
|
||||
if self.tool == "cargo" {
|
||||
command.env("CARGO_BUILD_JOBS", budget.jobs.to_string());
|
||||
command.env(
|
||||
@@ -1386,6 +1386,13 @@ impl Step {
|
||||
}
|
||||
}
|
||||
|
||||
fn workspace_root() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.expect("hemx-xtask must be a workspace member")
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
fn env_usize(key: &str) -> Option<usize> {
|
||||
env::var(key).ok()?.parse().ok()
|
||||
}
|
||||
@@ -1466,11 +1473,17 @@ mod tests {
|
||||
use super::{
|
||||
android_twa_release_json, create_app_scaffold, create_mobile_app_scaffold,
|
||||
create_workout_app, mobile_external_blockers, origin_host, verify_workout_mobile_release,
|
||||
workout_mobile_manifest, write_workout_mobile_release, Budget, WorkoutMobileConfig,
|
||||
workout_mobile_manifest, workspace_root, write_workout_mobile_release, Budget,
|
||||
WorkoutMobileConfig,
|
||||
};
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn verification_steps_resolve_the_workspace_independent_of_caller_directory() {
|
||||
assert!(workspace_root().join("Cargo.toml").is_file()); // req: test/004
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn budget_is_capped_by_available_memory() {
|
||||
// req: test/004
|
||||
|
||||
Reference in New Issue
Block a user