From 7df680bb0a2e3da35b27160b0e52b0e817c289a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 9 Jan 2023 21:19:48 +0000 Subject: [PATCH] add rust-version for MSRV and CI job to check (#6852) # Objective - Fixes #6777, fixes #2998, replaces #5518 - Help avoid confusing error message when using an older version of Rust ## Solution - Add the `rust-version` field to `Cargo.toml` - Add a CI job checking the MSRV - Add the job to bors --- .github/bors.toml | 1 + .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ Cargo.toml | 1 + 3 files changed, 28 insertions(+) diff --git a/.github/bors.toml b/.github/bors.toml index 7c237230f15ca..087a395e95150 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -17,6 +17,7 @@ status = [ "build-without-default-features (bevy)", "build-without-default-features (bevy_ecs)", "build-without-default-features (bevy_reflect)", + "msrv", ] use_squash_merge = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5b282b74a27c..eafdcfebbde87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -275,3 +275,29 @@ jobs: run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - name: Run cargo udeps run: cargo udeps + + msrv: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }} + - name: get MSRV + run: | + msrv=`cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name=="bevy") | .rust_version'` + echo "MSRV=$msrv" >> $GITHUB_ENV + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.MSRV }} + - name: Install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + - name: Run cargo check + run: cargo check diff --git a/Cargo.toml b/Cargo.toml index 2cd39656e74a1..d6e9a2e9bea69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"] license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/bevyengine/bevy" +rust-version = "1.66.0" [workspace] exclude = ["benches", "crates/bevy_ecs_compile_fail_tests", "crates/bevy_reflect_compile_fail_tests"]