Skip to content

Commit 5ae2acd

Browse files
committed
filter out none and all, and explain default try logic
1 parent 4197044 commit 5ae2acd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

xtask/src/ci/target_matrix.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ impl TargetMatrix {
7575
_ => (vec![], TargetMatrixArgs::default()),
7676
};
7777

78+
// only apply ci labels on prs and `/ci try`,
79+
// if the try command is not the default, we don't want to apply ci labels
7880
if matches!(
7981
self,
8082
Self {
@@ -362,26 +364,27 @@ impl TargetMatrixArgs {
362364
map.end()
363365
}
364366
}
365-
let tests = match (
367+
let mut tests = match (
366368
self.tests.iter().any(|t| t == "all"),
367369
self.tests.iter().any(|t| t == "none"),
368370
) {
369371
(_, true) => vec![],
370372
(true, false) => {
371-
let mut possible: Vec<String> = Self::command()
373+
let possible: Vec<String> = Self::command()
372374
.get_arguments()
373375
.find(|arg| arg.get_id() == "tests")
374376
.expect("a `tests` argument should exist")
375377
.get_possible_values()
376378
.into_iter()
377379
.map(|p| p.get_name().to_owned())
378380
.collect();
379-
possible.retain(|p| p != "all");
380-
possible.retain(|p| p != "none");
381+
381382
possible
382383
}
383384
_ => self.tests.clone(),
384385
};
386+
tests.retain(|p| p != "all");
387+
tests.retain(|p| p != "none");
385388
serde_json::to_value(Ser(tests))
386389
}
387390
}

0 commit comments

Comments
 (0)