diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc6a3b7..59f32c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ env: jobs: build_and_test: - name: Rust project - latest + name: Build & Test runs-on: ubuntu-latest strategy: matrix: @@ -20,8 +20,20 @@ jobs: - nightly steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - run: cargo build --verbose - run: cargo test --verbose - run: cargo build --all-features --verbose - run: cargo test --all-features --verbose + + build_docs: + name: Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - run: rustup update nightly && rustup default nightly + - run: RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --all-features diff --git a/Cargo.toml b/Cargo.toml index c40382b..1483b9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,9 @@ authors = ["Chielo Newctle "] exclude = ["release-plz.toml", "cliff.tolm"] [package.metadata.docs.rs] +# RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --all-features all-features = true -rustdoc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "doc_cfg"] [lib] name = "general_sam" diff --git a/src/lib.rs b/src/lib.rs index f9093ef..e212ee1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,6 +95,7 @@ //! //! [paper]: https://doi.org/10.1016/j.tcs.2009.03.034 //! [general-sam-oi-wiki]: https://oi-wiki.org/string/general-sam/ +#![cfg_attr(doc_cfg, feature(doc_cfg))] pub mod sam; pub mod trie_alike; @@ -108,10 +109,10 @@ pub use { }; #[cfg(feature = "trie")] -#[cfg_attr(docsrs, doc(cfg(feature = "trie")))] +#[cfg_attr(doc_cfg, doc(cfg(feature = "trie")))] pub mod trie; #[cfg(feature = "trie")] -#[cfg_attr(docsrs, doc(cfg(feature = "trie")))] +#[cfg_attr(doc_cfg, doc(cfg(feature = "trie")))] pub use trie::{Trie, TrieNode, TrieNodeID, TrieState, TRIE_NIL_NODE_ID, TRIE_ROOT_NODE_ID}; #[cfg(test)]