@@ -355,7 +355,18 @@ impl GlobalArgs {
355
355
}
356
356
}
357
357
358
- #[ derive( Debug , Clone , Default , strum:: EnumString , strum:: VariantNames , strum:: AsRefStr ) ]
358
+ #[ derive(
359
+ Debug ,
360
+ Clone ,
361
+ PartialEq ,
362
+ Eq ,
363
+ PartialOrd ,
364
+ Ord ,
365
+ Default ,
366
+ strum:: EnumString ,
367
+ strum:: VariantNames ,
368
+ strum:: AsRefStr ,
369
+ ) ]
359
370
#[ strum( serialize_all = "snake_case" ) ]
360
371
enum CheckKind {
361
372
#[ default]
@@ -370,7 +381,17 @@ impl CheckKind {
370
381
}
371
382
}
372
383
373
- #[ derive( Debug , Clone , strum:: EnumString , strum:: AsRefStr , strum:: VariantNames ) ]
384
+ #[ derive(
385
+ Debug ,
386
+ Clone ,
387
+ PartialEq ,
388
+ Eq ,
389
+ PartialOrd ,
390
+ Ord ,
391
+ strum:: EnumString ,
392
+ strum:: AsRefStr ,
393
+ strum:: VariantNames ,
394
+ ) ]
374
395
#[ strum( serialize_all = "snake_case" ) ]
375
396
enum Macro {
376
397
/// Integration tests for all script plugins
@@ -383,7 +404,7 @@ impl Macro {
383
404
}
384
405
}
385
406
386
- #[ derive( Clone , Debug , clap:: Subcommand , strum:: AsRefStr ) ]
407
+ #[ derive( Clone , Debug , PartialEq , Eq , PartialOrd , Ord , clap:: Subcommand , strum:: AsRefStr ) ]
387
408
#[ clap(
388
409
name = "xtask" ,
389
410
bin_name = "cargo xtask" ,
@@ -489,38 +510,31 @@ impl Xtasks {
489
510
}
490
511
} ,
491
512
Xtasks :: CiMatrix => {
492
- let output = Self :: ci_matrix ( app_settings) ?;
493
- let mut matrix = output
494
- . into_iter ( )
495
- . map ( |a| a. into_ci_row ( "ubuntu-latest" . to_owned ( ) ) )
496
- . collect :: < Vec < _ > > ( ) ;
497
-
498
- // clone for macos and windows for certain steps
499
- let mut multi_os_steps = matrix. clone ( ) ;
500
-
501
- // we don't need to verify all feature flags on all platforms, this is mostly a "does it compile" check
502
- // for finding out missing compile time logic or bad imports
503
- multi_os_steps
504
- . retain ( |e| !e. command . contains ( " build" ) && !e. command . contains ( " docs" ) ) ;
505
-
506
- let mut macos_matrix = multi_os_steps. clone ( ) ;
507
- let mut windows_matrix = multi_os_steps. clone ( ) ;
508
-
509
- for row in macos_matrix. iter_mut ( ) {
510
- row. os = "macos-latest" . to_owned ( ) ;
511
- row. name = row. name . replace ( "ubuntu-latest" , "macos-latest" ) ;
513
+ let mut output = Self :: ci_matrix ( app_settings) ?;
514
+ output. sort_by ( |e1, e2| e1. subcmd . cmp ( & e2. subcmd ) ) ;
515
+ let mut rows = Vec :: default ( ) ;
516
+ for os in & [ "ubuntu-latest" , "macos-latest" , "windows-latest" ] {
517
+ for row in output. iter_mut ( ) {
518
+ let is_main_os = os == & "ubuntu-latest" ;
519
+ let step_should_run_on_main_os =
520
+ matches ! ( row. subcmd, Xtasks :: Build | Xtasks :: Docs { .. } ) ;
521
+ let is_coverage_step = row. global_args . coverage ;
522
+
523
+ if !is_main_os && step_should_run_on_main_os {
524
+ continue ;
525
+ }
526
+
527
+ // we only need one source of coverage + windows is slow with this setting
528
+ if !is_main_os && is_coverage_step {
529
+ row. global_args . coverage = false ;
530
+ }
531
+
532
+ let row = row. clone ( ) . into_ci_row ( os. to_string ( ) ) ;
533
+ rows. push ( row) ;
534
+ }
512
535
}
513
536
514
- for row in windows_matrix. iter_mut ( ) {
515
- row. os = "windows-latest" . to_owned ( ) ;
516
- row. name = row. name . replace ( "ubuntu-latest" , "windows-latest" ) ;
517
- }
518
-
519
- matrix. extend ( macos_matrix) ;
520
- matrix. extend ( windows_matrix) ;
521
-
522
- matrix. sort_by_key ( |e| e. name . to_owned ( ) ) ;
523
- let json = serde_json:: to_string_pretty ( & matrix) ?;
537
+ let json = serde_json:: to_string_pretty ( & rows) ?;
524
538
return Ok ( json) ;
525
539
}
526
540
} ?;
0 commit comments