Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Use cargo 1.84 feature to check MSRV #160

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
50 changes: 33 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}})
Expand All @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
[workspace]
members = ["influxdb", "influxdb_derive", "benches"]

[workspace.package]
authors = ["Gero Gerke <[email protected]>", "Dominic <[email protected]>"]
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" }
4 changes: 2 additions & 2 deletions README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<a href="https://www.rust-lang.org/en-US/">
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
</a>
<a href="https://blog.rust-lang.org/2022/11/03/Rust-1.67.0.html">
<img src="https://img.shields.io/badge/rustc-1.67+-yellow.svg" alt='Minimum Rust Version: 1.67' />
<a href="https://github.com/rust-lang/rust/releases/tag/{{ rust_version | urlencode }}">
<img src="https://img.shields.io/badge/rustc-{{ rust_version | urlencode }}+-yellow.svg" alt='Minimum Rust Version: {{ rust_version }}' />
</a>
</p>

Expand Down
128 changes: 56 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,36 @@
<a href="https://www.rust-lang.org/en-US/">
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
</a>
<a href="https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html">
<img src="https://img.shields.io/badge/rustc-1.65+-yellow.svg" alt='Minimum Rust Version: 1.65' />
<a href="https://github.com/rust-lang/rust/releases/tag/1.65.0">
<img src="https://img.shields.io/badge/rustc-1.65.0+-yellow.svg" alt='Minimum Rust Version: 1.65.0' />
</a>
</p>

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<WriteQuery>` 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<WriteQuery>` 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};
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions influxdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[package]
name = "influxdb"
version = "0.7.2"
authors = ["Gero Gerke <[email protected]>"]
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 }
Expand Down
10 changes: 5 additions & 5 deletions influxdb_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[package]
name = "influxdb_derive"
version = "0.5.1"
authors = ["Gero Gerke <[email protected]>"]
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
Expand Down
Loading