diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push index b792e81a..6a0f996f 100755 --- a/.cargo-husky/hooks/pre-push +++ b/.cargo-husky/hooks/pre-push @@ -1,9 +1,15 @@ #!/usr/bin/env bash +# Exit immediately if any command returns non-zero exit status. +set -e + # `fmt` doesn't depend on which features are enabled echo "### fmt --all --check ###" cargo fmt --all --check +echo "### cargo doc --all-features --no-deps ###" +RUSTDOCFLAGS="-D rustdoc::all" cargo doc --all-features --no-deps + # With no features echo "### test --no-default-features --workspace ###" cargo test --no-default-features --workspace diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1582aac..f9c411a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,71 +10,18 @@ env: CARGO_TERM_COLOR: always jobs: - roadster_no_features: - name: No features + roadster_feature_powerset: + name: Feature powerset runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: taiki-e/install-action@cargo-hack - name: Test - run: cargo test --no-fail-fast --no-default-features --workspace + run: cargo hack test --no-fail-fast --feature-powerset --workspace - name: Check - run: cargo check --no-default-features --workspace + run: cargo hack check --feature-powerset --no-dev-deps --workspace - name: Clippy - run: cargo clippy --workspace --all-targets --no-default-features -- -D warnings - - roadster_default_features: - name: Default features - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Test - run: cargo test --no-fail-fast --workspace - - name: Check - run: cargo check --workspace - - name: Clippy - run: cargo clippy --workspace --all-targets -- -D warnings - - roadster_all_features: - name: All features - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Test - run: cargo test --no-fail-fast --all-features --workspace - - name: Check - run: cargo check --all-features --workspace - - name: Clippy - run: cargo clippy --workspace --all-targets --all-features -- -D warnings - - roadster_with_all_feature_combinations: - name: Feature combos - runs-on: ubuntu-latest - strategy: - matrix: - # Todo: Is there a way to generate this list automatically? - features: - - sidekiq - - db-sql - - open-api - - sidekiq,db-sql - - sidekiq,open-api - - db-sql,open-api - steps: - - uses: actions/checkout@v4 - - name: Test - run: cargo test --no-fail-fast --no-default-features --features ${{matrix.features}} --workspace - - name: Check - run: cargo check --no-default-features --workspace - - name: Clippy - run: cargo clippy --workspace --all-targets --features ${{matrix.features}} -- -D warnings - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Clippy - run: cargo clippy --workspace -- -D warnings + run: cargo hack clippy --workspace --all-targets --feature-powerset -- -D warnings check_formatting: name: Formatting @@ -83,3 +30,13 @@ jobs: - uses: actions/checkout@v4 - name: Formatting run: cargo fmt --all --check + + check-docs: + name: Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Docs + env: + RUSTDOCFLAGS: "-D rustdoc::all" + run: cargo doc --all-features --no-deps diff --git a/src/lib.rs b/src/lib.rs index f4dfbfde..40280ef7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,7 @@ +//! # Roadster +//! +//! Todo: Add documentation + #![forbid(unsafe_code)] pub mod app; diff --git a/src/util/serde_util.rs b/src/util/serde_util.rs index d6c32c08..2cbffe23 100644 --- a/src/util/serde_util.rs +++ b/src/util/serde_util.rs @@ -5,7 +5,7 @@ use serde::{de, Deserializer, Serializer}; use serde_derive::{Deserialize, Serialize}; use url::Url; -/// Custom deserializer to allow deserializing a string field as the given type type [T], as long as +/// Custom deserializer to allow deserializing a string field as the given type `T`, as long as /// the type implements [FromStr]. pub fn deserialize_from_str<'de, D, T>(deserializer: D) -> Result where @@ -21,7 +21,7 @@ where } } -/// Custom deserializer to allow serializing the given type [T] as a string, as long as the type +/// Custom serializer to allow serializing the given type `T` as a string, as long as the type /// implements [FromStr]. pub fn serialize_to_str(value: &T, serializer: S) -> Result where