diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-18 11:09:23 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-18 11:09:23 +0800 |
| commit | b1102be2682feb2d2182ead0fcc7ce12f8d0c865 (patch) | |
| tree | 6bb68f2a79600aa1144d05394b89de9286d385c9 /mingling_ci/src/cmd | |
| parent | 65464029958facf58c886a3ab5d4b9ab176f4e1c (diff) | |
refactor(mingling_ci): rename build, clippy, and docs commands to -check
suffix
Diffstat (limited to 'mingling_ci/src/cmd')
| -rw-r--r-- | mingling_ci/src/cmd/cmd_docs_build.rs | 44 | ||||
| -rw-r--r-- | mingling_ci/src/cmd/cmd_test_examples.rs | 69 |
2 files changed, 0 insertions, 113 deletions
diff --git a/mingling_ci/src/cmd/cmd_docs_build.rs b/mingling_ci/src/cmd/cmd_docs_build.rs deleted file mode 100644 index fe74419..0000000 --- a/mingling_ci/src/cmd/cmd_docs_build.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::ffi::OsString; - -use mingling::{ - Grouped, Routable, - macros::{buffer, command, renderer}, - res::ResExitCode, -}; - -use crate::Next; -use crate::res::ResFeatureList; -use crate::task::run::run_parallel_checks; - -#[command(node = "docs-build")] -pub async fn docs_build(features: &ResFeatureList) -> Next { - let args = vec![ - OsString::from("cargo"), - OsString::from("rustdoc"), - OsString::from("--features"), - OsString::from(features.list.join(",")), - OsString::from("-p"), - OsString::from("mingling"), - OsString::from("--"), - OsString::from("-D"), - OsString::from("warnings"), - ]; - let tasks = vec![("mingling".to_string(), "./mingling".to_string(), args)]; - let fail_count = run_parallel_checks("Docs-Build", "Docs", tasks).await; - - ResultDocsBuild { fail_count }.to_chain() -} - -/// Number of failed doc builds (0 or 1). -#[derive(Grouped)] -pub struct ResultDocsBuild { - pub fail_count: usize, -} - -/// Silently sets a non-zero exit code when the doc build failed. -#[renderer(buffer)] -pub fn render_docs_build(r: ResultDocsBuild, exit_code: &mut ResExitCode) { - if r.fail_count > 0 { - exit_code.exit_code = 1; - } -} diff --git a/mingling_ci/src/cmd/cmd_test_examples.rs b/mingling_ci/src/cmd/cmd_test_examples.rs deleted file mode 100644 index 602ada3..0000000 --- a/mingling_ci/src/cmd/cmd_test_examples.rs +++ /dev/null @@ -1,69 +0,0 @@ -use colored::Colorize; -use mingling::{ - Grouped, Routable, - macros::{buffer, command, renderer}, - res::ResExitCode, -}; - -use crate::Next; -use crate::examples::{check_example, load_test_configs}; -use crate::progress::task_progress_bar; -use crate::reporter::{self, ReportResult}; - -#[command(node = "test-examples")] -pub async fn test_examples() -> Next { - reporter::set_task("Test-Examples"); - - let configs = load_test_configs(); - let total = configs.len(); - let pb = task_progress_bar(total, "Testing"); - pb.set_message("examples"); - - // One blocking task per example: build + run its test cases. - let mut handles = Vec::new(); - for example in configs { - handles.push(tokio::task::spawn_blocking(move || check_example(example))); - } - - let mut fail_count = 0; - for handle in handles { - let Ok(outcome) = handle.await else { - continue; - }; - pb.set_message(outcome.name.clone()); - pb.inc(1); - - if outcome.ok { - reporter::export(&outcome.name, &outcome.location, ReportResult::Ok); - } else { - fail_count += 1; - // Plain stderr: `pb.println` is swallowed on non-TTY (CI). - eprintln!(" {} {}", "failed".bright_red(), outcome.name); - eprintln!(" {}", outcome.output); - reporter::export( - &outcome.name, - &outcome.location, - ReportResult::Error(outcome.output), - ); - } - } - - pb.finish_and_clear(); - reporter::flush(); - - ResultTestExamples { fail_count }.to_chain() -} - -/// Number of examples that failed to build or pass their tests. -#[derive(Grouped)] -pub struct ResultTestExamples { - pub fail_count: usize, -} - -/// Silently sets a non-zero exit code when any example failed. -#[renderer(buffer)] -pub fn render_test_examples(r: ResultTestExamples, exit_code: &mut ResExitCode) { - if r.fail_count > 0 { - exit_code.exit_code = 1; - } -} |
