]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
ci: set and verify MSRV
authorAlexander Fougner <fougner89@gmail.com>
Fri, 21 Jul 2023 09:41:54 +0000 (11:41 +0200)
committerAlexander Fougner <fougner89@gmail.com>
Fri, 4 Aug 2023 18:13:38 +0000 (20:13 +0200)
To prevent uncontrolled usage of new rust features, directly or from
dependencies, set a minimum supported Rust version and verify it builds.

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
.github/workflows/build-packages.yml
INSTALL.md
Makefile
rust-src/Cargo.toml

index e128a26768e11da1d74e5d9ed959878163f4847d..885464a93399fe364076d0162a07c775552b984e 100644 (file)
@@ -61,3 +61,29 @@ jobs:
         with:
           name: bcachefs-tools-rpm
           path: rpmbuild
+
+  msrv:
+    name: bcachefs-tools-msrv
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Disable initramfs update
+        run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf
+      - name: Disable man-db update
+        run: sudo rm -f /var/lib/man-db/auto-update
+      - name: Install build-deps
+        run: |
+          sudo apt-get update && sudo apt-get -y install pkg-config libaio-dev libblkid-dev \
+              libkeyutils-dev liblz4-dev libsodium-dev liburcu-dev libzstd-dev \
+              uuid-dev zlib1g-dev valgrind libudev-dev python3-docutils libclang-dev
+      - name: Extract MSRV
+        run: |
+          MSRV=$(cargo metadata --format-version 1 --no-deps --manifest-path rust-src/Cargo.toml |
+                  jq -r '.packages[] | select(.name == "bcachefs-rust") | .rust_version')
+          echo "MSRV=$MSRV" >> $GITHUB_ENV
+      - name: Install Rust ${{ env.MSRV }} toolchain
+        run: |
+          rustup install --profile minimal ${{ env.MSRV }}
+      - name: Make
+        run: |
+          CARGO_TOOLCHAIN_VERSION=${{ env.MSRV }} make -j`nproc`
index 94b28770777430ee0121d4e2ca276c3c37d1cd28..370fb8df7f83b1db6fd8225384df1e519eddad09 100644 (file)
@@ -16,7 +16,7 @@ Build dependencies:
  * zlib1g
 
 In addition a recent Rust toolchain is required (rustc, cargo), either by using
-[rustup](https://rustup.rs/) or make sure to use a distribution where rustc (>=1.64)
+[rustup](https://rustup.rs/) or make sure to use a distribution where rustc (>=1.65)
 is available.
 
 Debian (Bullseye or later) and Ubuntu (20.04 or later): you can install these with
index c77c0c51c2a0c1be872b5011ffedaca274455aff..fea4ef0d7bc8663a3e346219f4992ea6f38e49fa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,11 @@ CFLAGS+=-std=gnu11 -O2 -g -MMD -Wall -fPIC                   \
        $(EXTRA_CFLAGS)
 LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
 
-CARGO_ARGS=
+ifdef CARGO_TOOLCHAIN_VERSION
+  CARGO_TOOLCHAIN = +$(CARGO_TOOLCHAIN_VERSION)
+endif
+
+CARGO_ARGS=${CARGO_TOOLCHAIN}
 CARGO=cargo $(CARGO_ARGS)
 CARGO_PROFILE=release
 # CARGO_PROFILE=debug
index 92a3853f746847e405679482d9f5f35444bfd723..444f0cf9d9867869f94abbe7533e164c4fab6150 100644 (file)
@@ -3,6 +3,7 @@ name = "bcachefs-rust"
 version = "0.3.1"
 authors = ["Yuxuan Shui <yshuiv7@gmail.com>", "Kayla Firestack <dev@kaylafire.me>"]
 edition = "2018"
+rust-version = "1.65"
 
 [lib]
 crate-type = ["staticlib"]