Repository: yegor256/micromap
Pull request #276: Some CI improvements, remove unnecessary content, add `docs` ci to .workflow .
Author: login: owtotwo
Created: 2025-04-14T02:25:16Z | Merged: 2025-04-15T07:16:37Z

- Because GitHub Aciton supports _term color_, we can keep the output color (if no color is needed, just filter it).
- Because the Rust compiler's error reporting is very precise, there is almost no need to use `-vv`, which will wrap the error in a pile of useless output when building dependencies, so we don't need it very much. (Also this makes CI run much faster)
- The `--nocapture` is an old option, there is a newer and better replacement `--show-output`, we use it instead.


Diff:
diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml
index 5bf785bc..d8da3c15 100644
--- a/.github/workflows/cargo.yml
+++ b/.github/workflows/cargo.yml
@@ -13,17 +13,15 @@ jobs:
   build:
     timeout-minutes: 15
     runs-on: ubuntu-24.04
+    env:
+      CARGO_TERM_COLOR: always
     steps:
       - uses: actions/checkout@v4
-      - uses: actions/setup-java@v4
-        with:
-          distribution: 'temurin'
-          java-version: 17
       - uses: actions-rs/toolchain@v1
         with:
           toolchain: stable
-      - run: cargo --color=never test --all-features -vv -- --nocapture
-      - run: cargo --color=never test --release --all-features -vv -- --nocapture
-      - run: cargo --color=never fmt --check
-      - run: cargo --color=never doc --no-deps
-      - run: cargo --color=never clippy -- --no-deps
+      - run: cargo test --all-features -- --show-output
+      - run: cargo test --release --all-features -- --show-output
+      - run: cargo fmt --check
+      - run: cargo doc --no-deps
+      - run: cargo clippy -- --no-deps
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 00000000..b0ca24e1
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,23 @@
+# SPDX-FileCopyrightText: Copyright (c) 2023-2025 Yegor Bugayenko
+# SPDX-FileCopyrightText: Copyright (c) 2025 owtotwo
+# SPDX-License-Identifier: MIT
+---
+# yamllint disable rule:line-length
+name: docs
+'on':
+  push:
+  pull_request:
+jobs:
+  build:
+    timeout-minutes: 15
+    runs-on: ubuntu-24.04
+    env:
+      CARGO_TERM_COLOR: always
+      RUSTDOCFLAGS: '--cfg docsrs'
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: nightly
+      - run: cargo +nightly test --doc --all-features -- --show-output
+      - run: cargo +nightly doc --all-features --no-deps
diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml
index 08c6ac86..3b236026 100644
--- a/.github/workflows/examples.yml
+++ b/.github/workflows/examples.yml
@@ -11,6 +11,8 @@ jobs:
   run-examples:
     timeout-minutes: 15
     runs-on: ubuntu-24.04
+    env:
+      CARGO_TERM_COLOR: always
     steps:
       - uses: actions/checkout@v4
       - uses: actions-rs/toolchain@v1
diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml
index c8f946ee..08d076c4 100644
--- a/.github/workflows/markdown-lint.yml
+++ b/.github/workflows/markdown-lint.yml
@@ -7,6 +7,7 @@ name: markdown-lint
   push:
     branches:
       - master
+      - dev
   pull_request:
     branches:
       - master
diff --git a/.github/workflows/tarpaulin.yml b/.github/workflows/tarpaulin.yml
index e9deaa7d..c71dfb3d 100644
--- a/.github/workflows/tarpaulin.yml
+++ b/.github/workflows/tarpaulin.yml
@@ -7,6 +7,7 @@ name: tarpaulin
   push:
     branches:
       - master
+      - dev
 jobs:
   tarpaulin:
     timeout-minutes: 15
diff --git a/src/lib.rs b/src/lib.rs
index e8eb0434..ee022992 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,15 +26,18 @@
 //! will have exactly ten elements. An attempt to add an 11th element will lead
 //! to a panic.
 
-#![cfg_attr(docsrs, feature(doc_cfg))]
 #![cfg_attr(all(not(feature = "std"), not(doc), not(test)), no_std)]
 #![doc(html_root_url = "https://docs.rs/micromap/0.0.0")]
 #![deny(warnings)]
 #![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
 #![warn(rust_2018_idioms)]
-// #![warn(missing_docs)]
+// About the docs
+#![cfg_attr(docsrs, feature(doc_cfg))]
 #![cfg_attr(docsrs, feature(rustdoc_missing_doc_code_examples))]
 #![warn(rustdoc::missing_crate_level_docs)]
+// Our Goal, uncomment these!
+// #![warn(missing_docs)]
+// #![doc(test(attr(deny(unused))))]
 #![doc(test(attr(warn(unused))))]
 
 mod clone;


Reviews:
user: login: yegor256
state: COMMENTED
author_association: OWNER
submitted_at: 2025-04-14T03:26:41Z
user: login: owtotwo
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T06:48:18Z

Review comments:
diff_hunk: @@ -35,6 +35,7 @@
 // #![warn(missing_docs)]
 #![cfg_attr(docsrs, feature(rustdoc_missing_doc_code_examples))]
 #![warn(rustdoc::missing_crate_level_docs)]
+// #![doc(test(attr(deny(unused))))]
path: src/lib.rs
user: login: yegor256
body: @owtotwo leaving commented out code in the master branch is a bad practice, because later it may be hard to understand why the code is here, what's the reason for its commented-out status. It's better to delete it and create a separate ticket, which would explain what needs to be done _in the future_ with this place in the codee.
created_at: 2025-04-14T03:26:41Z
author_association: OWNER
diff_hunk: @@ -35,6 +35,7 @@
 // #![warn(missing_docs)]
 #![cfg_attr(docsrs, feature(rustdoc_missing_doc_code_examples))]
 #![warn(rustdoc::missing_crate_level_docs)]
+// #![doc(test(attr(deny(unused))))]
path: src/lib.rs
user: login: owtotwo
body: @yegor256 Good advice! This line is actually added by me on purpose, and its function is the same as the commented `#![warn(missing_docs)]` line above (we can confirm that **this is the final goal** without explanation, that is, **uncomment it**).

The reason why there is no comment to explain it, is that the line below it is "temporary", and the `warn` and `deny` in the adjacent lines are comments **used to switch between each other, which is obvious (self-explanatory)**. These two line are just for something we call _"Compiler Driven Development"_ (like _TDD_), the commented `#![warn(missing_docs)]` as well.

I usually add a `TODO: ...` tag to it, but CI will check and report an error, so I did it. Sorry for that I didn't think it through.

The correct approach should be to add a comment to it. (Cause this is the `master` branch and not the `dev` branch)
created_at: 2025-04-14T06:48:18Z
author_association: CONTRIBUTOR

PR comments:
user: login: owtotwo
created_at: 2025-04-14T02:28:16Z
body: @yegor256 Added CI (`.github/workflows/docs.yml`) specifically for documents, which is a preparation for improving documents later.
author_association: CONTRIBUTOR
user: login: owtotwo
created_at: 2025-04-14T06:58:27Z
body: @yegor256 It looks much clearer now!
author_association: CONTRIBUTOR
user: login: yegor256
created_at: 2025-04-15T07:16:33Z
body: @owtotwo have you heard about PDD? https://www.yegor256.com/2010/03/04/pdd.html We use in this repo. If you format a puzzle (TODO) in the code correctly, the bot will pick it up automatically and submit an issue. You can try next time :)
author_association: OWNER
user: login: yegor256
created_at: 2025-04-15T07:16:42Z
body: @owtotwo thanks for the contribution!
author_association: OWNER
user: login: owtotwo
created_at: 2025-04-15T11:05:35Z
body: > @owtotwo have you heard about PDD? https://www.yegor256.com/2010/03/04/pdd.html We use in this repo. If you format a puzzle (TODO) in the code correctly, the bot will pick it up automatically and submit an issue. You can try next time :)

@yegor256 It looks interesting!
I'm not sure if this methodology is suitable for Rust development, but I think I'll definitely try it if I have a chance. :)
author_association: CONTRIBUTOR