From 359fd0895c0a190967bdc0fb127c4c3ccca11590 Mon Sep 17 00:00:00 2001
From: Gero Gerke <hello@gero.dev>
Date: Fri, 13 Dec 2024 16:52:08 +0100
Subject: [PATCH] Add MSRV minimal versions in CI

---
 .github/workflows/rust.yml | 19 +++++++++++++++----
 README.j2                  |  4 ++--
 influxdb/Cargo.toml        |  1 +
 influxdb_derive/Cargo.toml |  1 +
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 1e44302..bc94844 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -44,6 +44,20 @@ 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}})
@@ -53,9 +67,6 @@ jobs:
       fail-fast: false
       matrix:
         rust:
-          - name: MSRV
-            toolchain: "1.65"
-            nightly: false
           - name: Stable
             toolchain: stable
             nightly: false
@@ -78,7 +89,7 @@ jobs:
             ~/.cargo/git
             ~/.cargo/registry
             target
-          key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
+          key: "${{matrix.rust.toolchain}} on ${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
       - run: cargo test --lib
       - run: cargo test --doc
 
diff --git a/README.j2 b/README.j2
index ead28b4..be728de 100644
--- a/README.j2
+++ b/README.j2
@@ -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.65.0.html">
-        <img src="https://img.shields.io/badge/rustc-1.65+-yellow.svg" alt='Minimum Rust Version: 1.65' />
+    <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>
 </p>
 
diff --git a/influxdb/Cargo.toml b/influxdb/Cargo.toml
index fec3c09..c31729a 100644
--- a/influxdb/Cargo.toml
+++ b/influxdb/Cargo.toml
@@ -11,6 +11,7 @@ license = "MIT"
 readme = "README.md"
 include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"]
 repository = "https://github.com/influxdb-rs/influxdb-rust"
+rust-version = "1.70"
 
 [dependencies]
 chrono = { version = "0.4.23", features = ["serde"], default-features = false }
diff --git a/influxdb_derive/Cargo.toml b/influxdb_derive/Cargo.toml
index f219d29..6e4b377 100644
--- a/influxdb_derive/Cargo.toml
+++ b/influxdb_derive/Cargo.toml
@@ -11,6 +11,7 @@ license = "MIT"
 readme = "README.md"
 include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"]
 repository = "https://github.com/influxdb-rs/influxdb-rust"
+rust-version = "1.70"
 
 [lib]
 proc-macro = true