diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 73a47429ba..2ec7e394b5 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -56,7 +56,7 @@ commands: ci archive build every shard's tests once and write shard k's nextest archive to $NEXTEST_ARCHIVE_DIR//$NEXTEST_ARCHIVE_NAME for k from 1 to $GATE_SHARDS; with CRAFT_CACHE_UNITS set, appends Cargo's JSON messages for the build to that file - ci doctests the workspace doctests + ci doctests the doctests of each shard's crates, one cargo command per shard ci checks the ci steps other than the tests, the doctests and the i18n report shards list the crates each shard tests; fails when a member is in no shard or in two, or builds with other features in its shard than in the whole workspace @@ -99,7 +99,7 @@ fn main() -> ExitCode { Some("test") => cmd_test().and_then(|()| cmd_doctests()), Some("ci") if rest.first() == Some(&"shard") => cmd_ci_shard(), Some("ci") if rest.first() == Some(&"archive") => cmd_ci_archive(), - Some("ci") if rest.first() == Some(&"doctests") => cmd_doctests(), + Some("ci") if rest.first() == Some(&"doctests") => cmd_ci_doctests(), Some("ci") if rest.first() == Some(&"checks") => cmd_ci_checks(), Some("ci") => cmd_ci(), Some("shards") => shards::run().map(drop), @@ -540,6 +540,17 @@ fn test_build(r: &shards::Run, units: bool) -> (Command, String) { (c, format!("cargo test {} --no-run ({})", targets.shown(), shards::names(&r.crates))) } +/// `cargo xtask ci doctests`: the doctests of each shard's crates, one cargo command per shard +/// with the crates `ci shard` runs them for, after `ci archive` (the shared gate's +/// `after-archive-command`). Every command runs before the first error is returned. +fn cmd_ci_doctests() -> Result<(), String> { + let mut result = Ok(()); + for s in shards::assigned()?.iter().filter(|s| s.part.is_none_or(|p| p.is_first())) { + result = result.and(doctest_packages(&shards::unit_crates(&s.runs))); + } + result +} + /// `cargo xtask ci checks`: every `ci` step other than [`TEST_STEPS`], for the shared gate's /// `lint` leg. fn cmd_ci_checks() -> Result<(), String> {