diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-18 11:04:01 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-18 11:04:01 +0800 |
| commit | 65464029958facf58c886a3ab5d4b9ab176f4e1c (patch) | |
| tree | 93faf4ee6e43d43ba7aa3fc3fae416fdb63e3550 | |
| parent | 78776ff4a91c470f075aa5148e48c02ca6e4d050 (diff) | |
feat(ci-new): add docs-build command to mingling_ci
| -rw-r--r-- | mingling_ci/help.txt | 1 | ||||
| -rw-r--r-- | mingling_ci/src/cmd.rs | 1 | ||||
| -rw-r--r-- | mingling_ci/src/cmd/cmd_docs_build.rs | 44 |
3 files changed, 46 insertions, 0 deletions
diff --git a/mingling_ci/help.txt b/mingling_ci/help.txt index 1391b37..de85c89 100644 --- a/mingling_ci/help.txt +++ b/mingling_ci/help.txt @@ -23,3 +23,4 @@ COMMANDS: clippy-all Run clippy with -D warnings on all crates test-all Test all crates test-examples Build examples and run their test.toml cases + docs-build Build mingling docs with -D warnings diff --git a/mingling_ci/src/cmd.rs b/mingling_ci/src/cmd.rs index b9664fc..3b057af 100644 --- a/mingling_ci/src/cmd.rs +++ b/mingling_ci/src/cmd.rs @@ -1,3 +1,4 @@ +pub(crate) mod cmd_docs_build; pub(crate) mod cmd_report_clean; pub(crate) mod cmd_report_collect; pub(crate) mod cmd_show_features; diff --git a/mingling_ci/src/cmd/cmd_docs_build.rs b/mingling_ci/src/cmd/cmd_docs_build.rs new file mode 100644 index 0000000..fe74419 --- /dev/null +++ b/mingling_ci/src/cmd/cmd_docs_build.rs @@ -0,0 +1,44 @@ +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; + } +} |
