diff --git a/.github/workflows/lint-rust/action.yml b/.github/workflows/lint-rust/action.yml index f188f889fc..0823dda958 100644 --- a/.github/workflows/lint-rust/action.yml +++ b/.github/workflows/lint-rust/action.yml @@ -41,7 +41,7 @@ runs: - run: | cargo update - cargo install --locked --version 0.15.1 cargo-deny + cargo install --locked cargo-deny cargo deny check --config ${GITHUB_WORKSPACE}/deny.toml working-directory: ${{ inputs.cargo-toml-folder }} shell: bash diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 2a6b59a3be..6c45d7707c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -296,8 +296,6 @@ jobs: run: sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work/valkey-glide - uses: actions/checkout@v4 - with: - submodules: recursive - name: Build Python wrapper uses: ./.github/workflows/build-python-wrapper diff --git a/.github/workflows/redis-rs.yml b/.github/workflows/redis-rs.yml index f2d3266531..8823536286 100644 --- a/.github/workflows/redis-rs.yml +++ b/.github/workflows/redis-rs.yml @@ -1,123 +1,124 @@ name: Redis-rs CI on: - push: - branches: - - main - - release-* - - v* - paths: - - glide-core/redis-rs/redis/** - - utils/cluster_manager.py - - deny.toml - - .github/workflows/install-shared-dependencies/action.yml - - .github/workflows/redis-rs.yml - pull_request: - paths: - - glide-core/redis-rs/redis/** - - utils/cluster_manager.py - - deny.toml - - .github/workflows/install-shared-dependencies/action.yml - - .github/workflows/redis-rs.yml - workflow_dispatch: - workflow_call: + push: + branches: + - main + - release-* + - v* + paths: + - glide-core/redis-rs/redis/** + - utils/cluster_manager.py + - deny.toml + - .github/workflows/install-shared-dependencies/action.yml + - .github/workflows/redis-rs.yml + pull_request: + paths: + - glide-core/redis-rs/redis/** + - utils/cluster_manager.py + - deny.toml + - .github/workflows/install-shared-dependencies/action.yml + - .github/workflows/redis-rs.yml + workflow_dispatch: + workflow_call: concurrency: - group: redis-rs-${{ github.head_ref || github.ref }} - cancel-in-progress: true + group: redis-rs-${{ github.head_ref || github.ref }} + cancel-in-progress: true env: - CARGO_TERM_COLOR: always + CARGO_TERM_COLOR: always jobs: - redis-rs-CI: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cargo - glide-core/redis-rs/redis/src/target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Cache cargo index - uses: actions/cache@v2 - with: - path: | - glide-core/redis-rs/redis/src/target - ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - - name: Cache cargo build - uses: actions/cache@v2 - with: - path: glide-core/redis-rs/redis/src/target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- - - - name: Install shared software dependencies - uses: ./.github/workflows/install-shared-dependencies - with: - os: "ubuntu" - target: "x86_64-unknown-linux-gnu" - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Build project - run: cargo build --release - - - name: Test - run: cargo test --release -- --nocapture --test-threads=1 - working-directory: ./glide-core/redis-rs/redis/src - - - name: Upload test reports - if: always() - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: test-reports-redis-rs - path: | - glide-core/redis-rs/redis/src/target/debug/deps/*.d - glide-core/redis-rs/redis/src/target/debug/deps/*.json - - - name: Run benchmarks - run: cargo bench - working-directory: ./glide-core/redis-rs/redis - - - name: Upload benchmark results - if: always() - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: benchmark-results-redis-rs - path: | - glide-core/redis-rs/redis/src/target/criterion/** - - - name: Test docs - run: cargo test --doc - working-directory: ./glide-core/redis-rs/redis/src - - - name: Security audit - run: cargo audit - working-directory: ./glide-core/redis-rs/redis - - - name: Run cargo machete - run: | - cargo install cargo-machete - cargo machete - working-directory: ./glide-core/redis-rs/redis - - - name: Lint redis-rs - uses: ./.github/workflows/lint-rust - with: - cargo-toml-folder: ./glide-core/redis-rs - github-token: ${{ secrets.GITHUB_TOKEN }} + redis-rs-CI: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install shared software dependencies + uses: ./.github/workflows/install-shared-dependencies + with: + os: "ubuntu" + target: "x86_64-unknown-linux-gnu" + engine-version: "7.2.5" + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Cache dependencies + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + workspaces: ./glide-core/redis-rs/redis + + + - name: Build project + run: cargo build --release + working-directory: ./glide-core/redis-rs/redis/src + + - name: Lint redis-rs + shell: bash + run: | + cargo fmt --all -- --check + cargo clippy -- -D warnings + cargo install --locked cargo-deny + cargo deny check all --config ${GITHUB_WORKSPACE}/deny.toml + working-directory: ./glide-core/redis-rs/redis + + - name: Test + run: | + cargo test --release -- --test-threads=1 | tee ../test-results.xml + echo "### Tests passed :v:" >> $GITHUB_STEP_SUMMARY + working-directory: ./glide-core/redis-rs/redis/src + + - name: Upload test reports + if: always() + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: test-reports-redis-rs + path: ./glide-core/redis-rs/redis/test-results.xml + + - name: Run benchmarks + run: | + cargo bench | tee bench-results.xml + working-directory: ./glide-core/redis-rs/redis + + - name: Upload benchmark results + if: always() + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: benchmark-results-redis-rs + path: ./glide-core/redis-rs/redis/bench-results.xml + + - name: Test docs + run: | + cargo test --doc + working-directory: ./glide-core/redis-rs/redis/src + + - name: Security audit + run: | + cargo audit | tee audit-results.txt + if grep -q "Crate: " audit-results.txt; then + echo "## Security audit results summary: Security vulnerabilities found :exclamation: :exclamation:" >> $GITHUB_STEP_SUMMARY + echo "Security audit results summary: Security vulnerabilities found" + else + echo "### Security audit results summary: All good, no security vulnerabilities found :closed_lock_with_key:" >> $GITHUB_STEP_SUMMARY + echo "Security audit results summary: All good, no security vulnerabilities found" + fi + working-directory: ./glide-core/redis-rs/redis + + - name: Run cargo machete + run: | + cargo install cargo-machete + cargo machete | tee machete-results.txt + if grep -A1 "cargo-machete found the following unused dependencies in this directory:" machete-results.txt | sed -n '2p' | grep -v "^if" > /dev/null; then + echo "Machete results summary: Unused dependencies found" >> $GITHUB_STEP_SUMMARY + echo "Machete results summary: Unused dependencies found" + cat machete-results.txt | grep -A1 "cargo-machete found the following unused dependencies in this directory:" | sed -n '2p' | grep -v "^if" >> $GITHUB_STEP_SUMMARY + else + echo "### Machete results summary: All good, no unused dependencies found :rocket:" >> $GITHUB_STEP_SUMMARY + echo "Machete results summary: All good, no unused dependencies found" + fi + working-directory: ./glide-core/redis-rs/redis diff --git a/.vscode/settings.json b/.vscode/settings.json index e6687b4b4c..72bcb0d6f7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -58,5 +58,5 @@ "black" ], "rust-analyzer.cargo.features": "all", - "dotnet.defaultSolution": "csharp/csharp.sln", + "dotnet.defaultSolution": "csharp/csharp.sln" } diff --git a/deny.toml b/deny.toml index f97a82f0c8..b9e8c1f00f 100644 --- a/deny.toml +++ b/deny.toml @@ -9,24 +9,6 @@ # The values provided in this template are the default values that will be used # when any section or field is not specified in your own configuration -# If 1 or more target triples (and optionally, target_features) are specified, -# only the specified targets will be checked when running `cargo deny check`. -# This means, if a particular package is only ever used as a target specific -# dependency, such as, for example, the `nix` crate only being used via the -# `target_family = "unix"` configuration, that only having windows targets in -# this list would mean the nix crate, as well as any of its exclusive -# dependencies not shared by any other crates, would be ignored, as the target -# list here is effectively saying which targets you are building for. -targets = [ - # The triple can be any string, but only the target triples built in to - # rustc (as of 1.40) can be checked against actual config expressions - #{ triple = "x86_64-unknown-linux-musl" }, - # You can also specify which target_features you promise are enabled for a - # particular target. target_features are currently not validated against - # the actual valid features supported by the target architecture. - #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, -] - # This section is considered when running `cargo deny check advisories` # More documentation for the advisories section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html @@ -35,22 +17,13 @@ targets = [ db-path = "~/.cargo/advisory-db" # The url(s) of the advisory databases to use db-urls = ["https://github.com/rustsec/advisory-db"] -# The lint level for security vulnerabilities -vulnerability = "deny" -# The lint level for unmaintained crates -unmaintained = "deny" # The lint level for crates that have been yanked from their source registry yanked = "deny" -# The lint level for crates with security notices. Note that as of -# 2019-12-17 there are no security notice advisories in -# https://github.com/rustsec/advisory-db -notice = "deny" -unsound = "deny" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ # Unmaintained dependency error that needs more attention due to nested dependencies - "RUSTSEC-2024-0370" + "RUSTSEC-2024-0370", ] # Threshold for security vulnerabilities, any vulnerability with a CVSS score # lower than the range specified will be ignored. Note that ignored advisories @@ -72,8 +45,6 @@ ignore = [ # More documentation for the licenses section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html [licenses] -# The lint level for crates which do not have a detectable license -unlicensed = "deny" # List of explicitly allowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. @@ -85,28 +56,8 @@ allow = [ "BSD-3-Clause", "Unicode-DFS-2016", "ISC", - "OpenSSL" -] -# List of explicitly disallowed licenses -# See https://spdx.org/licenses/ for list of possible licenses -# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. -deny = [ - #"Nokia", + "OpenSSL", ] -# Lint level for licenses considered copyleft -copyleft = "deny" -# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses -# * both - The license will be approved if it is both OSI-approved *AND* FSF -# * either - The license will be approved if it is either OSI-approved *OR* FSF -# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF -# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved -# * neither - This predicate is ignored and the default lint level is used -allow-osi-fsf-free = "neither" -# Lint level used when no other predicates are matched -# 1. License isn't in the allow or deny lists -# 2. License isn't copyleft -# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither" -default = "deny" # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the # canonical license text of a valid SPDX license file. @@ -137,7 +88,7 @@ expression = "MIT AND ISC AND OpenSSL" # depending on the rest of your configuration license-files = [ # Each entry is a crate relative path, and the (opaque) hash of its contents - { path = "LICENSE", hash = 0xbd0eed23 } + { path = "LICENSE", hash = 0xbd0eed23 }, ] [licenses.private] diff --git a/glide-core/Cargo.toml b/glide-core/Cargo.toml index 28cad8e646..150c0ff33d 100644 --- a/glide-core/Cargo.toml +++ b/glide-core/Cargo.toml @@ -32,7 +32,7 @@ integer-encoding = { version = "4.0.0", optional = true } thiserror = "1" rand = { version = "0.8.5" } futures-intrusive = "0.5.0" -directories = { version = "4.0", optional = true } +directories = { version = "5.0", optional = true } once_cell = "1.18.0" sha1_smol = "1.0.0" nanoid = "0.4.0" @@ -52,13 +52,13 @@ standalone_heartbeat = [] rsevents = "0.3.1" socket2 = "^0.5" tempfile = "3.3.0" -rstest = "^0.18" +rstest = "^0.23" serial_test = "3" criterion = { version = "^0.5", features = ["html_reports", "async_tokio"] } -which = "5" +which = "6" ctor = "0.2.2" redis = { path = "./redis-rs/redis", features = ["tls-rustls-insecure"] } -iai-callgrind = "0.9" +iai-callgrind = "0.14" tokio = { version = "1", features = ["rt-multi-thread"] } glide-core = { path = ".", features = [ "socket-layer", diff --git a/glide-core/redis-rs/redis/src/aio/multiplexed_connection.rs b/glide-core/redis-rs/redis/src/aio/multiplexed_connection.rs index c23d4dfca4..15df4e9aa8 100644 --- a/glide-core/redis-rs/redis/src/aio/multiplexed_connection.rs +++ b/glide-core/redis-rs/redis/src/aio/multiplexed_connection.rs @@ -23,7 +23,6 @@ use pin_project_lite::pin_project; use std::collections::VecDeque; use std::fmt; use std::fmt::Debug; -use std::io; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; diff --git a/glide-core/redis-rs/redis/src/connection.rs b/glide-core/redis-rs/redis/src/connection.rs index f75b9df494..f195d559c1 100644 --- a/glide-core/redis-rs/redis/src/connection.rs +++ b/glide-core/redis-rs/redis/src/connection.rs @@ -898,7 +898,7 @@ pub(crate) fn create_rustls_config( not(feature = "tls-native-tls"), not(feature = "tls-rustls-webpki-roots") ))] - for cert in load_native_certs()? { + for cert in load_native_certs().certs { root_store.add(cert)?; }