From 8e36f91a3d897dc251bd167b9ada7b7f0f67ed8f Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Tue, 4 Mar 2025 15:26:36 -0600 Subject: Update CI config (#124) * Fix axum test * Add comments explaining CI strategy * Bump deps and increase MSRV to 1.63 * Pin `csv` to an older version for MSRV * Keep serde_with as 2.0 for MSRV too --- .github/workflows/ci.yml | 66 ++++++++++++++++++++++++++++-------------------- Cargo.toml | 12 ++++----- README.md | 2 +- examples/introduction.rs | 2 +- src/axum.rs | 1 - 5 files changed, 46 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9034936..8353c96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,12 @@ name: Rust CI checks on: push: + pull_request: + +env: + CARGO_TERM_COLOR: always +# Make sure CI fails on all warnings, including Clippy lints + RUSTFLAGS: "-Dwarnings" jobs: lint: @@ -8,9 +14,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: - - stable - - 1.61.0 + feature: + - actix4,warp,axum + - actix3 steps: - uses: actions/checkout@v2 - name: Install Rust stable toolchain @@ -18,51 +24,55 @@ jobs: with: toolchain: stable components: rustfmt, clippy - - name: Check Rust formatting - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - name: Check clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets -- -D warnings + - name: Run formatting + run: cargo fmt --all --check + - name: Run Clippy + run: cargo clippy --all-targets -F "${{ matrix.feature }}" test: name: Run tests runs-on: ubuntu-latest strategy: matrix: + # NOTE: this crate's MSRC if 1.63 + # However, many of the web frameworks that + # this provides support for have greater/missing MSRVs. + # We attempt to test the MSRV here if it is known. rust: - stable - - 1.61.0 + - 1.63.0 feature: - "" - actix4 - actix3 - warp - axum + + # test frameworks for specific MSRVs (where known) + include: + # axum 0.8 has a MSRV of 1.75.0 + - rust: 1.75.0 + feature: axum + + # exclude frameworks that have a different/unknown MSRV exclude: - - rust: 1.61.0 + - rust: 1.63.0 + feature: axum + # actix does not seem to actually adhere + # to its MSRV -- it states 1.75 but has a dependency `zerofrom` + # that requires Rust 1.81. We'll punt on testing it + - rust: 1.63.0 feature: actix4 - - rust: 1.61.0 + - rust: 1.63.0 feature: actix3 - - rust: 1.61.0 + # warp does not list an MSRV + # see: https://github.com/seanmonstar/warp/issues/1077 + - rust: 1.63.0 feature: warp - - rust: 1.61.0 - feature: axum steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.toml') }} + - uses: actions/checkout@v4 - name: Install Rust stable toolchain - uses: dtolnay/rust-toolchain@master + uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} - name: Run test ${{ matrix.feature }} diff --git a/Cargo.toml b/Cargo.toml index 461dfee..e9857fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,24 +9,24 @@ license = "MIT/Apache-2.0" name = "serde_qs" repository = "https://github.com/samscott89/serde_qs" readme = "README.md" -version = "0.13.0" -rust-version = "1.61" +version = "0.14.0-alpha.1" +rust-version = "1.63" [dependencies] actix-web4 = { version = "4.0", optional = true, package = "actix-web", default-features = false } actix-web3 = { version = "3.3", optional = true, package = "actix-web", default-features = false } futures = { version = "0.3", optional = true } percent-encoding = "2.1" -serde = "1.0" -thiserror = "1.0" +serde = { version = "1.0", features = ["derive"] } +thiserror = "2.0" tracing = { version = "0.1", optional = true } warp-framework = { package = "warp", version = "0.3", default-features = false, optional = true } axum-framework = { package = "axum", version = "0.8", default-features = false, optional = true } [dev-dependencies] chrono = { version = "0.4", features = ["serde"] } -csv = "1.3" -rand = "0.8" +csv = "=1.2.2" +rand = "0.9" serde_derive = "1.0" serde_urlencoded = "0.7" serde_with = "2.0" diff --git a/README.md b/README.md index daedf31..39d0f25 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ This crate works with Cargo and can be found on serde_qs = "0.13" ``` -Minimum supported Rust version is 1.61 due to dependencies. +Minimum supported Rust version is 1.63 due to dependencies. For older versions of Rust, `serde_qs` versions `<= 0.11` support Rust 1.36. diff --git a/examples/introduction.rs b/examples/introduction.rs index 10e7a8b..bf4c508 100644 --- a/examples/introduction.rs +++ b/examples/introduction.rs @@ -101,7 +101,7 @@ fn main() { "user_ids[3]=4", ]; - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); for _ in 0..10 { let mut acc = String::new(); inputs.shuffle(&mut rng); diff --git a/src/axum.rs b/src/axum.rs index 42bc0a6..3b603f3 100644 --- a/src/axum.rs +++ b/src/axum.rs @@ -148,7 +148,6 @@ impl std::fmt::Debug for OptionalQsQuery { } } -#[axum::async_trait] impl FromRequestParts for OptionalQsQuery where T: serde::de::DeserializeOwned, -- cgit v1.2.3