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..202af1a9ab 100644 --- a/.github/workflows/redis-rs.yml +++ b/.github/workflows/redis-rs.yml @@ -1,123 +1,129 @@ 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: Cache cargo + if: always() + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ./glide-core/redis-rs/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - 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: 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 --exclude-dev --format human --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/glide-core/redis-rs/redis/Cargo.toml b/glide-core/redis-rs/redis/Cargo.toml index 0179669eaf..2117b1af89 100644 --- a/glide-core/redis-rs/redis/Cargo.toml +++ b/glide-core/redis-rs/redis/Cargo.toml @@ -33,7 +33,7 @@ strum_macros = "0.26" percent-encoding = "2.1" # We need this for redis url parsing -url = "= 2.5.0" +url = "= 2.5.2" # We need this for script support sha1_smol = { version = "1.0", optional = true } @@ -78,10 +78,10 @@ native-tls = { version = "0.2", optional = true } tokio-native-tls = { version = "0.3", optional = true } # Only needed for rustls -rustls = { version = "0.22", optional = true } +rustls = { version = "0.23", optional = true, features = ["ring"] } webpki-roots = { version = "0.26", optional = true } -rustls-native-certs = { version = "0.7", optional = true } -tokio-rustls = { version = "0.25", optional = true } +rustls-native-certs = { version = "0.8", optional = true } +tokio-rustls = { version = "0.26", optional = true } rustls-pemfile = { version = "2", optional = true } rustls-pki-types = { version = "1", optional = true } @@ -168,7 +168,7 @@ assert_approx_eq = "1.0" fnv = "1.0.5" futures = "0.3" futures-time = "3" -criterion = "0.4" +criterion = "0.5" partial-io = { version = "0.5", features = ["tokio", "quickcheck1"] } quickcheck = "1.0.3" tokio = { version = "1", features = [ @@ -177,11 +177,11 @@ tokio = { version = "1", features = [ "rt-multi-thread", "time", ] } -tempfile = "=3.6.0" +tempfile = "3.13" once_cell = "1" anyhow = "1" sscanf = "0.4.1" -serial_test = "2" +serial_test = "3" [[test]] name = "test_async" 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)?; }