diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e63209f4f0c..6fed5058746 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,7 @@ jobs: check_fmt_and_docs: timeout-minutes: 30 - name: Checking fmt and docs + name: Checking fmt runs-on: ubuntu-latest env: RUSTC_WRAPPER: "sccache" @@ -123,8 +123,23 @@ jobs: - name: fmt run: cargo fmt --all -- --check + name: Checking docs + runs-on: ubuntu-latest + env: + RUSTC_WRAPPER: "sccache" + SCCACHE_GHA_ENABLED: "on" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly-2024-05-02 + - name: Install sccache + uses: mozilla-actions/sccache-action@v0.0.4 + - name: Docs run: cargo doc --workspace --all-features --no-deps --document-private-items + env: + RUSTDOCFLAGS: --cfg docsrs clippy_check: timeout-minutes: 30 diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index 9d70e2df98f..03c0f711566 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -76,6 +76,12 @@ testdir = "0.9.1" tokio = { version = "1", features = ["macros", "io-util", "rt"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } +[package.metadata.docs.rs] +all-features = true +# enable unstable features in the documentation +rustdoc-args = ["--cfg", "docsrs"] + + [[example]] name = "hello-world-provide" diff --git a/iroh/src/lib.rs b/iroh/src/lib.rs index c6bfd8e7687..2fbf25cc8b7 100644 --- a/iroh/src/lib.rs +++ b/iroh/src/lib.rs @@ -1,4 +1,11 @@ //! Send data over the internet. +//! +//! ## Feature Flags +//! +//! - `metrics`: Enable metrics collection +//! - `fs-store`: Enables the disk based storage backend for `iroh-bytes`. +//! +#![cfg_attr(docsrs, feature(doc_cfg))] #![deny(missing_docs, rustdoc::broken_intra_doc_links)] // re-export the iroh crates @@ -20,4 +27,5 @@ mod sync_engine; /// Expose metrics module #[cfg(feature = "metrics")] +#[cfg_attr(all(docsrs, feature = "metrics"), doc(cfg(feature = "metrics")))] pub mod metrics;