From 4fbdb3073468708b77987cb03b4a2aae7fddc9a5 Mon Sep 17 00:00:00 2001 From: Michal Pokrywka Date: Thu, 30 Apr 2026 08:42:45 +0200 Subject: [PATCH] Prepared 0.2.0 --- .github/workflows/pipeline.yaml | 166 ++++++++++++++------------------ CHANGES.md | 3 +- README.md | 10 +- src/config.rs | 1 - src/lib.rs | 4 +- 5 files changed, 86 insertions(+), 98 deletions(-) diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml index 0065e86..ab4ae36 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/pipeline.yaml @@ -1,123 +1,105 @@ name: Build on: [push, pull_request] +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse + RUSTC_WRAPPER: "sccache" + RUSTFLAGS: -D warnings + SCCACHE_GHA_ENABLED: "true" + jobs: - nightly-clippy: - name: Nightly Clippy + nightly: + name: Nightly runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write # For Clippy PR annotations + checks: write # For Clippy check status + env: + SCCACHE_GHA_CACHE_NAME: "nightly" steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Cache Cargo registry - uses: actions/cache@v5 + - uses: actions/checkout@v6 + - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/cache@v5 with: - path: ~/.cargo/registry + path: | + ~/.cargo/registry + ~/.cargo/git + target/release/deps + target/debug/deps key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo build - uses: actions/cache@v5 + - uses: dtolnay/rust-toolchain@nightly with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- + components: clippy, rustfmt - - name: Set up Rust Nightly - uses: dtolnay/rust-toolchain@nightly - with: - components: clippy + # Formatting check + - name: Check formatting + run: cargo fmt -- --check - - name: Run Clippy - run: cargo clippy -- -D warnings + # Tests + - name: Run Cargo Tests (default features) + run: cargo test - nightly-test: - name: Nightly Tests - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v6 + - name: Run Cargo Tests (all features) + run: cargo test --all-features - - name: Cache Cargo registry - uses: actions/cache@v5 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- + - name: Run Cargo Tests (no features) + run: cargo test --no-default-features - - name: Cache Cargo build - uses: actions/cache@v5 + # Clippy and post annotations + - name: Clippy Check + uses: giraffate/clippy-action@v1 with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- - - - name: Set up Rust Nightly - uses: dtolnay/rust-toolchain@nightly - - - name: Run Cargo Tests - run: cargo test --all-features + reporter: github-pr-review + github_token: ${{ secrets.GITHUB_TOKEN }} - stable-clippy: - name: Stable Clippy + stable: + name: Stable runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + checks: write + env: + SCCACHE_GHA_CACHE_NAME: "stable" steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Cache Cargo registry - uses: actions/cache@v5 + - uses: actions/checkout@v6 + - uses: mozilla-actions/sccache-action@v0.0.9 + - uses: actions/cache@v5 with: - path: ~/.cargo/registry + path: | + ~/.cargo/registry + ~/.cargo/git + target/release/deps + target/debug/deps key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo build - uses: actions/cache@v5 - with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- - - - name: Set up Rust Stable - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@stable with: components: clippy - - name: Run Clippy - run: cargo clippy -- -D warnings + # Formatting check + - name: Check formatting + run: cargo fmt -- --check - stable-test: - name: Stable Tests - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v6 + # Tests + - name: Run Cargo Tests (default features) + run: cargo test - - name: Cache Cargo registry - uses: actions/cache@v5 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo build - uses: actions/cache@v5 - with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- + - name: Run Cargo Tests (all features) + run: cargo test --all-features - - name: Set up Rust Stable - uses: dtolnay/rust-toolchain@stable + - name: Run Cargo Tests (no features) + run: cargo test --no-default-features - - name: Run Cargo Tests - run: cargo test --all-features + # Clippy and post annotations + - name: Clippy Check + uses: giraffate/clippy-action@v1 + with: + reporter: github-pr-review + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGES.md b/CHANGES.md index eb82da9..8f864cf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ -## 0.2.0 - Unreleased +## 0.2.0 - 2026-04-30 ### Added @@ -9,6 +9,7 @@ The reconnect loop is then spawned by `WStompConfig::build_and_connect`, which in the reconnecting state returns a `WStompReconnectHandle` instead of a `WStompClient`. +* Certificate authentication - `connect_ssl_with_cert`. ## 0.1.0 - 2025-11-18 diff --git a/README.md b/README.md index 8076c2e..2206107 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -wstomp = "0.1.0" # Replace with the actual version +wstomp = "0.2" actix-rt = "2.0" ``` @@ -38,7 +38,7 @@ For SSL support, enable the `rustls` feature: ```toml [dependencies] -wstomp = { version = "0.1.0", features = ["rustls"] } +wstomp = { version = "0.2", features = ["rustls"] } ``` ## Usage @@ -146,7 +146,7 @@ use wstomp::connect_with_token; #[actix_rt::main] async fn main() { let url = "ws://my-server.com/ws/websocket"; - let token = "my-secret-jwt-token"; + let token = "my-secret-token"; let client = connect_with_token(url, token) .await @@ -163,6 +163,8 @@ If you are connecting to a `wss://` endpoint and need SSL, use the `rustls` feat These helpers are specially configured to force HTTP/1.1, which can be necessary for compatibility with some WebSocket servers (like those using SockJS). ```rust,no_run +# #[cfg(feature = "rustls")] { + // Make sure to enable the "rustls" feature in Cargo.toml use wstomp::connect_ssl_with_pass; @@ -179,6 +181,8 @@ async fn main() { println!("Connected securely!"); // ... use client } + +# } ``` ### Auto-reconnect diff --git a/src/config.rs b/src/config.rs index eb34cbc..8f9db1e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -167,7 +167,6 @@ impl WStompConfig { self } - /// Appends a list of custom headers to the connection configuration. /// /// These headers will be included in the STOMP `CONNECT` frame. diff --git a/src/lib.rs b/src/lib.rs index ae54cc0..040c309 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,9 @@ mod stomp_handler; #[cfg(feature = "rustls")] mod connect_ssl; #[cfg(feature = "rustls")] -pub use connect_ssl::{connect_ssl, connect_ssl_with_pass, connect_ssl_with_token, connect_ssl_with_cert}; +pub use connect_ssl::{ + connect_ssl, connect_ssl_with_cert, connect_ssl_with_pass, connect_ssl_with_token, +}; pub mod wstomp_event; pub use wstomp_event::{WStompConnectError, WStompError, WStompEvent};