diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 500cf18..605aa00 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,6 +11,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + - name: "Setup: Install Rust" uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: @@ -21,22 +24,19 @@ jobs: with: tool: cargo-llvm-cov - - name: Checkout - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose + run: cargo build --workspace --all-features - name: Format - run: cargo fmt --package redsumer --all --check + run: cargo fmt --all --check - name: Lints - run: cargo clippy --package redsumer --all-features --verbose + run: cargo clippy --workspace --all-features - name: Unit Tests - run: cargo test --package redsumer --verbose - - - name: Coverage env: MIN_LINE_COVERAGE_TARGET: 80 - run: cargo llvm-cov --package redsumer --all-features --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }} + run: cargo llvm-cov --workspace --all-features --show-missing-lines --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }} + + - name: Doc Tests + run: cargo test --workspace --all-features --doc diff --git a/Makefile b/Makefile index 89b2534..a1c4de1 100644 --- a/Makefile +++ b/Makefile @@ -5,25 +5,22 @@ fmt-check: cargo fmt --all --check check: - cargo check --all-features + cargo check --workspace --all-features clippy-check: - cargo clippy --all-features + cargo clippy --workspace --all-features install-llvm-cov: cargo install cargo-llvm-cov test-llvm-cov-report: - cargo llvm-cov --html --workspace --all-features + cargo llvm-cov --workspace --all-features --show-missing-lines --open test-llvm-cov-target: - cargo llvm-cov --workspace --all-features --summary-only --fail-under-lines 70 + cargo llvm-cov --workspace --all-features --show-missing-lines --summary-only --fail-under-lines 80 -test: - cargo test --all-features +test-doc: + cargo test --workspace --all-features --doc doc: - cargo doc --all-features - -doc-open: - cargo doc --all-features --open \ No newline at end of file + cargo doc --workspace --all-features --open \ No newline at end of file diff --git a/README.md b/README.md index 657d0ad..db30b38 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# redsumer-rs +# REDSUMER
@@ -21,20 +21,6 @@ A lightweight implementation of Redis Streams for Rust, allowing you to manage s - **Produce** new messages in a specific *stream*. - **Consume** messages from specific *stream*, setting config parameters that allow you a flexible implementation. It also provides an option to minimize the possibility of consuming the same message simultaneously by more than one consumers from the same consumer group. -To use ***redsumer*** from GitHub repository with specific version, set the dependency in Cargo.toml file as follows: - -```ini -[dependencies] -redsumer = { git = "https://github.com/enerBit/redsumer-rs.git", package = "redsumer", version = "0.5.0" } -``` - -You can depend on it via cargo by adding the following dependency to your `Cargo.toml` file: - -```ini -[dependencies] -redsumer = { version = "0.5.0" } -``` - ## Basic Usage #### Produce a new stream message: @@ -170,7 +156,7 @@ async fn main() { panic!( "Error checking if message is still in consumer pending list: {:?}", error ); - }).is_still_mine() { + }).belongs_to_me() { // Process message ... println!("Processing message: {:?}", message); // ... diff --git a/redsumer-rs/CHANGELOG.md b/redsumer-rs/CHANGELOG.md index c731c35..8e2efea 100644 --- a/redsumer-rs/CHANGELOG.md +++ b/redsumer-rs/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added: + +- ⚡ Implement `belongs_to_me()` in `IsStillMineReply` to verify if the message is still in consumer pending list. Function `is_still_mine()` was deprecated. By [@JMTamayo](https://github.com/JMTamayo). +- ⚡ Implement *Doc Tests* in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). + +### Changed: + +- 🚀 Unify *Unit Tests* and *Coverage* steps in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). +- 🚀 Making the *Checkout* step the first step in the pipeline to ensure that the code is available prior to the execution of the CI flow. By [@JMTamayo](https://github.com/JMTamayo). +- 🚀 Apply all steps for workspace in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). + ## ✨ v0.5.0 [2024-10-26] ### Added: diff --git a/redsumer-rs/Cargo.toml b/redsumer-rs/Cargo.toml index ea1708e..15a57d5 100644 --- a/redsumer-rs/Cargo.toml +++ b/redsumer-rs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "redsumer" description = "Lightweight implementation of Redis Streams for Rust" -version = "0.5.0" +version = "0.5.1" edition = "2021" license-file = "../LICENSE" readme = "../README.md" @@ -20,7 +20,7 @@ authors = [ ] [dependencies] -redis = { version = ">=0.27.2", features = ["tokio-comp", "streams"] } +redis = { version = ">=0.27.2", features = ["streams"] } tracing = { version = ">=0.1.40" } [dev-dependencies] diff --git a/redsumer-rs/src/lib.rs b/redsumer-rs/src/lib.rs index b9a37f3..67f73ce 100644 --- a/redsumer-rs/src/lib.rs +++ b/redsumer-rs/src/lib.rs @@ -3,20 +3,6 @@ //! - **Produce** new messages in a specific *stream*. //! - **Consume** messages from specific *stream*, setting config parameters that allow you a flexible implementation. It also provides an option to minimize the possibility of consuming the same message simultaneously by more than one consumers from the same consumer group. //! -//! To use ***redsumer*** from GitHub repository with specific version, set the dependency in Cargo.toml file as follows: -//! -//! ```ini -//! [dependencies] -//! redsumer = { git = "https://github.com/enerBit/redsumer-rs.git", package = "redsumer", version = "0.5.0" } -//! ``` -//! -//! You can depend on it via cargo by adding the following dependency to your `Cargo.toml` file: -//! -//! ```ini -//! [dependencies] -//! redsumer = { version = "0.5.0" } -//! ``` -//! //! ## Basic Usage //! //! #### Produce a new stream message: @@ -154,7 +140,7 @@ //! panic!( //! "Error checking if message is still in consumer pending list: {:?}", error //! ); -//! }).is_still_mine() { +//! }).belongs_to_me() { //! // Process message ... //! println!("Processing message: {:?}", message); //! // ... diff --git a/redsumer-rs/src/redsumer/consumer.rs b/redsumer-rs/src/redsumer/consumer.rs index ff6429b..004219c 100644 --- a/redsumer-rs/src/redsumer/consumer.rs +++ b/redsumer-rs/src/redsumer/consumer.rs @@ -312,7 +312,13 @@ pub struct IsStillMineReply { impl IsStillMineReply { /// Get **is still mine**. + #[deprecated(note = "Please use the `belongs_to_me` function instead")] pub fn is_still_mine(&self) -> bool { + self.belongs_to_me() + } + + /// Verify if the message still belongs to the consumer. + pub fn belongs_to_me(&self) -> bool { self.is_still_mine } @@ -793,7 +799,7 @@ mod test_is_still_mine_reply { )); // Verify the result: - assert!(reply.is_still_mine()); + assert!(reply.belongs_to_me()); assert!(reply.get_last_delivered_milliseconds().is_some()); assert!(reply