Skip to content

Commit

Permalink
chore(docs): fix docs and add ci for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChieloNewctle committed Oct 26, 2023
1 parent b37b5cd commit 5844b7c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
build_and_test:
name: Rust project - latest
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ authors = ["Chielo Newctle <[email protected]>"]
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"
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)]
Expand Down

0 comments on commit 5844b7c

Please sign in to comment.