diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bc94844..abac801 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -44,20 +44,6 @@ jobs: - name: Check code formatting run: cargo fmt --all -- --check - # this checks the msrv - msrv: - name: Verify MSRV - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: baptiste0928/cargo-install@v3 - with: - crate: cargo-msrv - - name: Verify minimum rust version of influxdb crate - run: cargo msrv --path influxdb --output-format json verify - - name: Verify minimum rust version of influxdb_derive crate - run: cargo msrv --path influxdb_derive --output-format json verify - # this tests that all unit and doc tests are successful unit_tests: name: Unit and Doc Tests (Rust ${{matrix.rust.name}} on ${{matrix.os}}) @@ -77,21 +63,51 @@ jobs: toolchain: nightly nightly: true os: [ubuntu-latest, windows-latest, macOS-latest] + include: + - rust: + name: MSRV + toolchain: stable + nightly: false + os: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust.toolchain}} id: rust-toolchain + - run: cargo --config 'resolver.incompatible-rust-versions="fallback"' update + # on msrv runs, downgrade rust after generating the Cargo.lock file + - run: sudo apt -y update && sudo apt -y install --no-install-recommends yq + if: matrix.rust.name == 'MSRV' + - run: echo "rust-version=$(tomlq -r '.workspace.package."rust-version"' Cargo.toml)" >>$GITHUB_OUTPUT + id: msrv + if: matrix.rust.name == 'MSRV' + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{steps.msrv.outputs.rust-version}} + id: msrv-toolchain + if: matrix.rust.name == 'MSRV' + # on non-msrv runs, use one cache key ... + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/git + ~/.cargo/registry + target + key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" + if: matrix.rust.name != 'MSRV' + # ... and on msrv runs, use another - uses: actions/cache@v4 with: path: | ~/.cargo/git ~/.cargo/registry target - key: "${{matrix.rust.toolchain}} on ${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" - - run: cargo test --lib - - run: cargo test --doc + key: "${{runner.os}} Rust ${{steps.msrv-toolchain.outputs.cachekey}}" + if: matrix.rust.name == 'MSRV' + # finally we can run tests + - run: cargo test --lib --locked + - run: cargo test --doc --locked # this tests that all integration tests are successful integration_tests: diff --git a/Cargo.toml b/Cargo.toml index d87619e..c66c4af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,14 @@ [workspace] members = ["influxdb", "influxdb_derive", "benches"] +[workspace.package] +authors = ["Gero Gerke ", "Dominic "] +edition = "2018" +# always put fully qualified version here, e.g. 1.65.0 (**NOT** 1.65) +rust-version = "1.65" +license = "MIT" +repository = "https://github.com/influxdb-rs/influxdb-rust" + [patch.crates-io] influxdb = { path = "./influxdb" } influxdb_derive = { path = "./influxdb_derive" } diff --git a/README.j2 b/README.j2 index be728de..cba6ed7 100644 --- a/README.j2 +++ b/README.j2 @@ -25,8 +25,8 @@ Build with Rust - - Minimum Rust Version: 1.67 + + Minimum Rust Version: {{ rust_version }}

diff --git a/README.md b/README.md index 9865904..289ed65 100644 --- a/README.md +++ b/README.md @@ -25,40 +25,36 @@ Build with Rust - - Minimum Rust Version: 1.65 + + Minimum Rust Version: 1.65.0

Pull requests are always welcome. See [Contributing][__link0] and [Code of Conduct][__link1]. For a list of past changes, see [CHANGELOG.md][__link2]. - ### Currently Supported Features - - Reading and writing to InfluxDB - - Optional Serde support for deserialization - - Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`) - - Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec` argument) - - Authenticated and unauthenticated connections - - `async`/`await` support - - `#[derive(InfluxDbWriteable)]` derive macro for writing / reading into structs - - `GROUP BY` support - - Tokio and async-std support (see example below) or [available backends][__link3] - - Swappable HTTP backends ([see below](#Choice-of-HTTP-backend)) - +* Reading and writing to InfluxDB +* Optional Serde support for deserialization +* Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`) +* Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec` argument) +* Authenticated and unauthenticated connections +* `async`/`await` support +* `#[derive(InfluxDbWriteable)]` derive macro for writing / reading into structs +* `GROUP BY` support +* Tokio and async-std support (see example below) or [available backends][__link3] +* Swappable HTTP backends ([see below](#Choice-of-HTTP-backend)) ## Quickstart Add the following to your `Cargo.toml` - ```toml influxdb = { version = "0.7.2", features = ["derive"] } ``` For an example with using Serde deserialization, please refer to [serde_integration][__link4] - ```rust use chrono::{DateTime, Utc}; use influxdb::{Client, Error, InfluxDbWriteable, ReadQuery, Timestamp}; @@ -104,73 +100,62 @@ async fn main() -> Result<(), Error> { } ``` -For further examples, check out the integration tests in `tests/integration_tests.rs` in the repository. - +For further examples, check out the integration tests in `tests/integration_tests.rs` +in the repository. ## Choice of HTTP backend To communicate with InfluxDB, you can choose the HTTP backend to be used configuring the appropriate feature. We recommend sticking with the default reqwest-based client, unless you really need async-std compatibility. - - **[hyper][__link5]** (through reqwest, used by default), with [rustls][__link6] - ```toml - influxdb = { version = "0.7.2", features = ["derive"] } - ``` - - - - **[hyper][__link7]** (through reqwest), with native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls"] } - ``` - - - - **[hyper][__link8]** (through reqwest), with vendored native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] } - ``` - - - - **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] } - ``` - - - - **[curl][__link10]**, using [libcurl][__link11] - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] } - ``` - - - - **[async-h1][__link12]** with native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] } - ``` - - - - **[async-h1][__link13]** with [rustls][__link14] - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] } - ``` - - - - WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]** - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] } - ``` - - - +* **[hyper][__link5]** (through reqwest, used by default), with [rustls][__link6] + ```toml + influxdb = { version = "0.7.2", features = ["derive"] } + ``` + +* **[hyper][__link7]** (through reqwest), with native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls"] } + ``` + +* **[hyper][__link8]** (through reqwest), with vendored native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] } + ``` + +* **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] } + ``` + +* **[curl][__link10]**, using [libcurl][__link11] + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] } + ``` + +* **[async-h1][__link12]** with native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] } + ``` + +* **[async-h1][__link13]** with [rustls][__link14] + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] } + ``` + +* WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]** + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] } + ``` ## License -[![License: MIT][__link16]][__link17] - +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][__link16] @ 2020-2024 Gero Gerke, msrd0 and [contributors]. [contributors]: https://github.com/influxdb-rs/influxdb-rust/graphs/contributors - [__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG_RDmlyxxvyrG0rwcLBKoYdvG5It9hbWNgjUGzjD8iBYfsFFYXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg + [__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGzJ_QpW55zB1G0S-TER-rIfLG2gXv8EYBG3jG1nuXXn-kdx-YXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg [__link0]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CONTRIBUTING.md [__link1]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CODE_OF_CONDUCT.md [__link10]: https://github.com/alexcrichton/curl-rust @@ -179,8 +164,7 @@ To communicate with InfluxDB, you can choose the HTTP backend to be used configu [__link13]: https://github.com/http-rs/async-h1 [__link14]: https://github.com/ctz/rustls [__link15]: https://github.com/rustwasm/wasm-bindgen - [__link16]: https://img.shields.io/badge/License-MIT-yellow.svg - [__link17]: https://opensource.org/licenses/MIT + [__link16]: https://opensource.org/licenses/MIT [__link2]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CHANGELOG.md [__link3]: https://github.com/influxdb-rs/influxdb-rust/blob/main/influxdb/Cargo.toml [__link4]: https://docs.rs/influxdb/0.7.2/influxdb/?search=integrations::serde_integration diff --git a/influxdb/Cargo.toml b/influxdb/Cargo.toml index c31729a..f88f841 100644 --- a/influxdb/Cargo.toml +++ b/influxdb/Cargo.toml @@ -3,15 +3,15 @@ [package] name = "influxdb" version = "0.7.2" -authors = ["Gero Gerke <11deutron11@gmail.com>"] -edition = "2018" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true description = "InfluxDB Driver for Rust" keywords = ["influxdb", "database", "influx"] -license = "MIT" +license.workspace = true readme = "README.md" include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"] -repository = "https://github.com/influxdb-rs/influxdb-rust" -rust-version = "1.70" +repository.workspace = true [dependencies] chrono = { version = "0.4.23", features = ["serde"], default-features = false } diff --git a/influxdb_derive/Cargo.toml b/influxdb_derive/Cargo.toml index 6e4b377..7c5df57 100644 --- a/influxdb_derive/Cargo.toml +++ b/influxdb_derive/Cargo.toml @@ -3,15 +3,15 @@ [package] name = "influxdb_derive" version = "0.5.1" -authors = ["Gero Gerke <11deutron11@gmail.com>"] -edition = "2018" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true description = "Private implementation detail of the influxdb crate" keywords = ["influxdb", "database", "influx", "derive"] -license = "MIT" +license.workspace = true readme = "README.md" include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"] -repository = "https://github.com/influxdb-rs/influxdb-rust" -rust-version = "1.70" +repository.workspace = true [lib] proc-macro = true