Skip to content

Commit da86e0c

Browse files
committed
actually use the right path and only upload coverage from ubuntu
1 parent 782d3b9 commit da86e0c

File tree

2 files changed

+51
-35
lines changed

2 files changed

+51
-35
lines changed

.github/workflows/bevy_mod_scripting.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
${{ matrix.run_args.command }}
7777
7878
- name: Upload lcov files if any exist
79+
if: ${{ matrix.run_args.os == 'ubuntu-latest' }}
7980
uses: actions/upload-artifact@v4
8081
with:
8182
name: lcov-${{ matrix.run_args.os }}-${{ matrix.run_args.name }}
@@ -100,9 +101,10 @@ jobs:
100101
run: |
101102
sudo apt-get install lcov -y
102103
- name: Report code coverage
103-
uses: dethereum/github-actions-report-lcov@v1.0.0
104+
uses: zgosalvez/github-actions-report-lcov@v3
104105
with:
105-
coverage-files: coverage/lcov.*
106+
coverage-files: |
107+
**/lcov.info
106108
minimum-coverage: 50
107109
artifact-name: code-coverage-report
108110
github-token: ${{ secrets.GITHUB_TOKEN }}

crates/xtask/src/main.rs

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,18 @@ impl GlobalArgs {
355355
}
356356
}
357357

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+
)]
359370
#[strum(serialize_all = "snake_case")]
360371
enum CheckKind {
361372
#[default]
@@ -370,7 +381,17 @@ impl CheckKind {
370381
}
371382
}
372383

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+
)]
374395
#[strum(serialize_all = "snake_case")]
375396
enum Macro {
376397
/// Integration tests for all script plugins
@@ -383,7 +404,7 @@ impl Macro {
383404
}
384405
}
385406

386-
#[derive(Clone, Debug, clap::Subcommand, strum::AsRefStr)]
407+
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::Subcommand, strum::AsRefStr)]
387408
#[clap(
388409
name = "xtask",
389410
bin_name = "cargo xtask",
@@ -489,38 +510,31 @@ impl Xtasks {
489510
}
490511
},
491512
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+
}
512535
}
513536

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)?;
524538
return Ok(json);
525539
}
526540
}?;

0 commit comments

Comments
 (0)