From 42ca1b047135048f5fec78888036bc9a2c03540e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 13 Feb 2024 11:17:47 +0100 Subject: [PATCH] Update MSRV to 1.71 and add CI test (#589) Update MSRV in Cargo.toml and Readme to be up to date with the dependencies that we're using, plus add a test to check that we don't deviate from it. The dependency causing the bump is `env_logger` with a MSRV of 1.71 (released July 2023) https://github.com/rust-cli/env_logger/blob/9303b0c0393c33046a791b0a6497b0f03ef1f434/Cargo.toml#L8 The issue seems to also be affecting other crates in the workspace that don't depend on that crate because the MSRV bump is due to some cargo changes regarding `dep:` features and so it seems to affect the version resolution of the entire workspace. Note that this required a small change to exporters, apparently older rust versions have trouble disambiguating the `csv` crate with the `csv` module. --- .github/workflows/minimum-rust-version.yml | 46 ++++++++++++++++++++++ crates/bitwarden-c/Cargo.toml | 2 +- crates/bitwarden-cli/Cargo.toml | 2 +- crates/bitwarden-crypto/Cargo.toml | 2 +- crates/bitwarden-exporters/src/lib.rs | 2 +- crates/bitwarden-generators/Cargo.toml | 2 +- crates/bitwarden-json/Cargo.toml | 2 +- crates/bitwarden-napi/Cargo.toml | 2 +- crates/bitwarden-py/Cargo.toml | 2 +- crates/bitwarden-uniffi/Cargo.toml | 2 +- crates/bitwarden-wasm/Cargo.toml | 2 +- crates/bitwarden/Cargo.toml | 2 +- crates/bitwarden/README.md | 2 +- crates/bw/Cargo.toml | 2 +- crates/bws/Cargo.toml | 2 +- crates/sdk-schemas/Cargo.toml | 2 +- crates/uniffi-bindgen/Cargo.toml | 2 +- 17 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/minimum-rust-version.yml diff --git a/.github/workflows/minimum-rust-version.yml b/.github/workflows/minimum-rust-version.yml new file mode 100644 index 000000000..d3eccf653 --- /dev/null +++ b/.github/workflows/minimum-rust-version.yml @@ -0,0 +1,46 @@ +--- +name: Minimum Rust Version + +on: + pull_request: + push: + branches: + - "main" + - "rc" + - "hotfix-rc" + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + msrv: + name: Check MSRV for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} + runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} + strategy: + fail-fast: false + matrix: + settings: + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install rust + uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # stable + with: + # Important: When updating this, make sure to update the Readme file + # and also the `rust-version` field in all the `Cargo.toml`. + toolchain: 1.71.0 + targets: ${{ matrix.settings.target }} + + - name: Cache cargo registry + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + key: msrv-${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} + + - name: cargo check MSRV + run: cargo check -p bitwarden --all-features diff --git a/crates/bitwarden-c/Cargo.toml b/crates/bitwarden-c/Cargo.toml index c6f0ec7f3..211a482e9 100644 --- a/crates/bitwarden-c/Cargo.toml +++ b/crates/bitwarden-c/Cargo.toml @@ -2,7 +2,7 @@ name = "bitwarden-c" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [lib] crate-type = ["lib", "staticlib", "cdylib"] diff --git a/crates/bitwarden-cli/Cargo.toml b/crates/bitwarden-cli/Cargo.toml index 4248c9189..cf28447d3 100644 --- a/crates/bitwarden-cli/Cargo.toml +++ b/crates/bitwarden-cli/Cargo.toml @@ -2,7 +2,7 @@ name = "bitwarden-cli" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [dependencies] clap = { version = "4.4.18", features = ["derive"] } diff --git a/crates/bitwarden-crypto/Cargo.toml b/crates/bitwarden-crypto/Cargo.toml index f0eac0d0a..54a9f760e 100644 --- a/crates/bitwarden-crypto/Cargo.toml +++ b/crates/bitwarden-crypto/Cargo.toml @@ -10,7 +10,7 @@ Internal crate for the bitwarden crate. Do not use. """ keywords = ["bitwarden"] edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] default = [] diff --git a/crates/bitwarden-exporters/src/lib.rs b/crates/bitwarden-exporters/src/lib.rs index 814633489..f17d31a2d 100644 --- a/crates/bitwarden-exporters/src/lib.rs +++ b/crates/bitwarden-exporters/src/lib.rs @@ -4,7 +4,7 @@ use thiserror::Error; use uuid::Uuid; mod csv; -use csv::export_csv; +use crate::csv::export_csv; mod json; use json::export_json; mod encrypted_json; diff --git a/crates/bitwarden-generators/Cargo.toml b/crates/bitwarden-generators/Cargo.toml index d790cb5d1..8f06de664 100644 --- a/crates/bitwarden-generators/Cargo.toml +++ b/crates/bitwarden-generators/Cargo.toml @@ -10,7 +10,7 @@ Internal crate for the bitwarden crate. Do not use. """ keywords = ["bitwarden"] edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] mobile = ["uniffi"] # Mobile-specific features diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index 1e0473c44..5949ce8cf 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -11,7 +11,7 @@ JSON bindings for the Bitwarden Secret Manager SDK keywords = ["bitwarden", "secrets manager"] categories = ["api-bindings"] edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] internal = ["bitwarden/internal"] # Internal testing methods diff --git a/crates/bitwarden-napi/Cargo.toml b/crates/bitwarden-napi/Cargo.toml index 4b6ff4ed1..296f5f45f 100644 --- a/crates/bitwarden-napi/Cargo.toml +++ b/crates/bitwarden-napi/Cargo.toml @@ -10,7 +10,7 @@ N-API bindings for the Bitwarden Secrets Manager SDK """ keywords = ["bitwarden", "secrets manager"] edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [lib] crate-type = ["cdylib", "rlib"] diff --git a/crates/bitwarden-py/Cargo.toml b/crates/bitwarden-py/Cargo.toml index e81f2f5a8..f954b0a20 100644 --- a/crates/bitwarden-py/Cargo.toml +++ b/crates/bitwarden-py/Cargo.toml @@ -2,7 +2,7 @@ name = "bitwarden-py" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [lib] name = "bitwarden_py" diff --git a/crates/bitwarden-uniffi/Cargo.toml b/crates/bitwarden-uniffi/Cargo.toml index 7f780558b..eb316ceca 100644 --- a/crates/bitwarden-uniffi/Cargo.toml +++ b/crates/bitwarden-uniffi/Cargo.toml @@ -2,7 +2,7 @@ name = "bitwarden-uniffi" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] docs = ["dep:schemars"] # Docs diff --git a/crates/bitwarden-wasm/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml index d0ae7482e..547ea25ff 100644 --- a/crates/bitwarden-wasm/Cargo.toml +++ b/crates/bitwarden-wasm/Cargo.toml @@ -2,7 +2,7 @@ name = "bitwarden-wasm" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [lib] crate-type = ["cdylib"] diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 7f0745fb8..9950a788a 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -10,7 +10,7 @@ Bitwarden Secrets Manager SDK """ keywords = ["bitwarden", "secrets-manager"] edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] default = ["secrets"] diff --git a/crates/bitwarden/README.md b/crates/bitwarden/README.md index abb2b5dd4..0846651eb 100644 --- a/crates/bitwarden/README.md +++ b/crates/bitwarden/README.md @@ -13,7 +13,7 @@ bitwarden = { "*", features = ["secrets"] } ## Minimum Supported Rust Version -Rust **1.57** or higher. +Rust **1.71** or higher. ## Example diff --git a/crates/bw/Cargo.toml b/crates/bw/Cargo.toml index 32fd03159..068094039 100644 --- a/crates/bw/Cargo.toml +++ b/crates/bw/Cargo.toml @@ -2,7 +2,7 @@ name = "bw" version = "0.0.2" edition = "2021" -rust-version = "1.60" +rust-version = "1.71" authors = ["Bitwarden Inc"] license-file = "LICENSE" repository = "https://github.com/bitwarden/sdk" diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index bbd813e78..2ceab6499 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -2,7 +2,7 @@ name = "bws" version = "0.4.0" edition = "2021" -rust-version = "1.60" +rust-version = "1.71" authors = ["Bitwarden Inc"] license-file = "LICENSE" repository = "https://github.com/bitwarden/sdk" diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 81a9d76ca..dda54e86a 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -2,7 +2,7 @@ name = "sdk-schemas" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [features] internal = [ diff --git a/crates/uniffi-bindgen/Cargo.toml b/crates/uniffi-bindgen/Cargo.toml index e8f6f3f3d..9809eeb72 100644 --- a/crates/uniffi-bindgen/Cargo.toml +++ b/crates/uniffi-bindgen/Cargo.toml @@ -2,7 +2,7 @@ name = "uniffi-bindgen" version = "0.1.0" edition = "2021" -rust-version = "1.57" +rust-version = "1.71" [[bin]] # This can be whatever name makes sense for your project, but the rest of this tutorial assumes uniffi-bindgen.