From 14d472d079a7f2610e81f642fc11a7675c548355 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 5 Nov 2024 20:58:09 -0500 Subject: [PATCH 1/5] Use `--workspace` where `--all` is deprecated Most `cargo` commands that support `--all` to affect the entire workspace rather than a single package have deprecated it in favor of `--workspace` and treat them as synonyms. The major exception (at least as relevant to this repository) is `cargo fmt`, which recognizes `--all` and not `--workspace`. This replaces `--all` with `--workspace` in `cargo check`, `cargo doc`, and `cargo nextest` commands in a CI workflow and the `justfile`. All these subcommands have deprecated `--all` in favor of `--workspace`, and document this in relevant `--help` output. (Other major subcommands that recommend `--workspace` over its deprecated `--all` alias include `cargo build` and `cargo test`, but there are currently no occurrences of such commands with `--all` in this repository.) --- .github/workflows/ci.yml | 4 ++-- justfile | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e790c66e8e9..5a2372aca7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,14 +67,14 @@ jobs: brew install tree openssl gnu-sed - name: "cargo check default features" if: startsWith(matrix.os, 'windows') - run: cargo check --all --bins --examples + run: cargo check --workspace --bins --examples - uses: taiki-e/install-action@v2 with: tool: nextest - name: "Test (nextest)" env: GIX_TEST_CREATE_ARCHIVES_EVEN_ON_CI: 1 - run: cargo nextest run --all --no-fail-fast + run: cargo nextest run --workspace --no-fail-fast - name: Doctest run: cargo test --doc - name: Check that tracked archives are up to date diff --git a/justfile b/justfile index b0b0c0f4060..dfd3b44c634 100755 --- a/justfile +++ b/justfile @@ -38,7 +38,7 @@ clippy-fix: # Build all code in suitable configurations check: - cargo check --all + cargo check --workspace cargo check --no-default-features --features small # assure compile error occurs if cargo check --features lean-async 2>/dev/null; then false; else true; fi @@ -146,8 +146,8 @@ check: # Run cargo doc on all crates doc $RUSTDOCFLAGS="-D warnings": - cargo doc --all --no-deps --features need-more-recent-msrv - cargo doc --features=max,lean,small --all --no-deps --features need-more-recent-msrv + cargo doc --workspace --no-deps --features need-more-recent-msrv + cargo doc --features=max,lean,small --workspace --no-deps --features need-more-recent-msrv # run all unit tests unit-tests: From ebc3495115b3695e4fb685c3c60d67deeb514249 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 5 Nov 2024 21:11:56 -0500 Subject: [PATCH 2/5] Actually run doctests in CI `test-fast` jobs The `test-fast` job has been intended to run doctests since 89a0567 (#1556). But because there are no doctests in the top-level project and neither `--workspace` nor its `--all` alias were passed, the effect has been: Compiling ... Finished `test` profile [unoptimized + debuginfo] target(s) in 28.55s Doc-tests gitoxide running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s (Where ... stands for details in various "Compiling lines. That output is copied from https://github.com/GitoxideLabs/gitoxide/actions/runs/11690609999/job/32555922512#step:9:70 though that log will eventually become unavailable, and only the build time changes.) Note that zero tests are run and the status reports zero of each possible kind of result. There are (at least currently) no doctests in the top-level package, and `--workspace` is not implied. This adds `--workspace` to the command that runs the doctests, so it will collect and run doctests throughout the entire workspace. For now, this is not done on the corresponding command in the `unit-tests` rule in `justfile`; it may make sense to do that, but if it is done, then this step should probably be omitted on the `ubuntu-latest` run of `test-fast` since the CI job that runs `just unit-tests` is `test` which itself runs on `ubuntu-latest`. (The changes in #1556 were revised in #1559, but that only fixed a problem with reporting results from non-doctest tests. I had not noticed the problem of not running any doctests at that time.) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a2372aca7a..2907633ee53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: GIX_TEST_CREATE_ARCHIVES_EVEN_ON_CI: 1 run: cargo nextest run --workspace --no-fail-fast - name: Doctest - run: cargo test --doc + run: cargo test --workspace --doc - name: Check that tracked archives are up to date run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive. From 2fdbcfe17cdcc480e320582d7c6b48f8b615bf3b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 5 Nov 2024 21:50:23 -0500 Subject: [PATCH 3/5] doc: Fix code fences in gix-merge `ConflictStyle` and `Driver` They are not Rust code (they are text with conflict markers and a shell command, respectively) and they are not intended as doctests, but the absence of anything on the opening line caused them to be taken as doctests, so `cargo test --workspace --doc` would fail with parsing errors. (Doctests for all crates have not always been run automatically on CI, so this was not caught when these documentation comments were introduced in #1585.) --- gix-merge/src/blob/builtin_driver/text/mod.rs | 11 ++++++----- gix-merge/src/blob/mod.rs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gix-merge/src/blob/builtin_driver/text/mod.rs b/gix-merge/src/blob/builtin_driver/text/mod.rs index a3b38048abd..0252f423c40 100644 --- a/gix-merge/src/blob/builtin_driver/text/mod.rs +++ b/gix-merge/src/blob/builtin_driver/text/mod.rs @@ -8,20 +8,21 @@ pub enum ConflictStyle { /// Only show the zealously minified conflicting lines of the local changes and the incoming (other) changes, /// hiding the base version entirely. /// - /// ``` + /// ```text /// line1-changed-by-both /// <<<<<<< local /// line2-to-be-changed-in-incoming /// ======= /// line2-changed /// >>>>>>> incoming - ///``` + /// ``` #[default] Merge, /// Show non-minimized hunks of local changes, the base, and the incoming (other) changes. /// /// This mode does not hide any information. - /// ``` + /// + /// ```text /// <<<<<<< local /// line1-changed-by-both /// line2-to-be-changed-in-incoming @@ -32,12 +33,12 @@ pub enum ConflictStyle { /// line1-changed-by-both /// line2-changed /// >>>>>>> incoming - ///``` + /// ``` Diff3, /// Like [`Diff3](Self::Diff3), but will show *minimized* hunks of local change and the incoming (other) changes, /// as well as non-minimized hunks of the base. /// - /// ``` + /// ```text /// line1-changed-by-both /// <<<<<<< local /// line2-to-be-changed-in-incoming diff --git a/gix-merge/src/blob/mod.rs b/gix-merge/src/blob/mod.rs index d114f3dee05..fbf578e054d 100644 --- a/gix-merge/src/blob/mod.rs +++ b/gix-merge/src/blob/mod.rs @@ -96,7 +96,7 @@ pub struct Driver { /// /// A typical invocation with all arguments substituted could then look like this: /// - /// ``` + /// ```sh /// .merge_file_nR2Qs1 .merge_file_WYXCJe .merge_file_UWbzrm 7 file e2a2970 HEAD feature /// ``` /// From da87bec944a80f017bdb017be6363ec43dfb92c0 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 5 Nov 2024 22:58:10 -0500 Subject: [PATCH 4/5] When a doctest fails, run further doctests Instead of stopping running doctests even in other packages. This change only applies to the `test-fast` job on CI. It does not affect any default configuration for doctests, nor the `justfile`. The reason for making this change before fixing the remaining doctest failure (which is in `gix-pack/src/index/mod.rs`) is to confirm that it takes effect on CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2907633ee53..d5d04efc9a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: GIX_TEST_CREATE_ARCHIVES_EVEN_ON_CI: 1 run: cargo nextest run --workspace --no-fail-fast - name: Doctest - run: cargo test --workspace --doc + run: cargo test --workspace --doc --no-fail-fast - name: Check that tracked archives are up to date run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive. From 0783e9c1648261ad4a9af1904d65abedf24821d9 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 5 Nov 2024 23:24:56 -0500 Subject: [PATCH 5/5] Mark gix-pack vendored `izip!` doctest `ignore` That macro is not exported, and adjusting the doctest so that it can run successfully (or even compile) might be tricky without a significant change (or adding dependencies). This fixes a failure when running doctests for the whole workspace (as CI now includes). This change is not "user-facing", as the macro is not part of the public interface of `gix_pack`. Its documentation comment doesn't appear https://docs.rs/gix-pack/0.54.0/gix_pack/index/index.html. Nonetheless, this adds a note to clarify the change, to avoid attributing it to the original code from which this was vendored. --- gix-pack/src/index/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gix-pack/src/index/mod.rs b/gix-pack/src/index/mod.rs index 8d880744241..b6e689a6e09 100644 --- a/gix-pack/src/index/mod.rs +++ b/gix-pack/src/index/mod.rs @@ -1,5 +1,5 @@ //! an index into the pack file -//! + /// From itertools /// Create an iterator running multiple iterators in lockstep. /// @@ -21,7 +21,7 @@ /// /// [`multizip`]: fn.multizip.html /// -/// ``` +/// ```ignore /// # use itertools::izip; /// # /// # fn main() { @@ -37,6 +37,9 @@ /// assert_eq!(results, [0 + 3, 10 + 7, 29, 36]); /// # } /// ``` +/// +/// (The above is vendored from [itertools](https://github.com/rust-itertools/itertools), +/// including the original doctest, though it has been marked `ignore` here.) macro_rules! izip { // @closure creates a tuple-flattening closure for .map() call. usage: // @closure partial_pattern => partial_tuple , rest , of , iterators