From 4857fefc90276c2d6bfe244d994865a2b4e754b8 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 13 Dec 2023 01:06:42 +0100 Subject: [PATCH] ci: simplify, test MSRV. - Use separate jobs instead of `matrix`. The Github Actions matrix is very cursed, especially if you use `include`. We don't have that many combinations, IMO doing separate jobs is way more straightforward and only slightly more verbose. - `embedded-hal` needs `rust-version = 1.60` because it uses `dep:`. Fixes #538 --- .github/workflows/test.yml | 70 +++++++++++++++++++--------------- Cargo.stable.toml | 20 ---------- embedded-hal-async/Cargo.toml | 2 +- embedded-hal-async/README.md | 11 ++---- embedded-hal-bus/README.md | 2 + embedded-hal/Cargo.toml | 2 +- embedded-io-adapters/README.md | 5 +-- embedded-io-async/Cargo.toml | 1 + embedded-io-async/README.md | 7 ++-- 9 files changed, 52 insertions(+), 68 deletions(-) delete mode 100644 Cargo.stable.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19ff36502..f7abf9027 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,38 +13,48 @@ env: jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - - 1.60.0 # MSRV - - nightly - target: - - x86_64-unknown-linux-gnu - - thumbv7m-none-eabi - features: - - '' - include: - - rust: stable - target: x86_64-unknown-linux-gnu - features: std - - rust: stable - target: x86_64-unknown-linux-gnu - features: alloc - - rust: nightly - target: x86_64-unknown-linux-gnu - features: std,tokio-1,futures-03,defmt-03 steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} + - uses: dtolnay/rust-toolchain@beta + - run: cargo test --workspace + + test-all-features: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@beta + - run: cargo test --workspace --all-features - - run: mv Cargo.stable.toml Cargo.toml - if: matrix.rust != 'nightly' + build-nostd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@beta + with: + target: thumbv7m-none-eabi + - run: > + cargo build + --workspace + --target thumbv7m-none-eabi + --features async,defmt-03 - - run: cargo check --target=${{ matrix.target }} --features=${{ matrix.features }} + msrv-1-60: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@1.60 + - run: > + cargo test + -p embedded-hal:1.0.0-rc.2 + -p embedded-hal-bus + -p embedded-hal-nb + -p embedded-io + -p embedded-io-adapters + -p embedded-can - - run: cargo test --target=${{ matrix.target }} --features=${{ matrix.features }} - if: contains(matrix.target, 'linux') + msrv-1-75: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@beta + - run: cargo test --workspace --all-features diff --git a/Cargo.stable.toml b/Cargo.stable.toml deleted file mode 100644 index 78f6fd3cd..000000000 --- a/Cargo.stable.toml +++ /dev/null @@ -1,20 +0,0 @@ -# CI moves this file to `Cargo.toml` when building for stable. - -[workspace] -resolver = "2" - -members = [ - "embedded-hal", - "embedded-hal-nb", - "embedded-hal-bus", - "embedded-can", - "embedded-io", - "embedded-io-adapters", -] - -# Cargo implicitly adds path dependencies to the workspace. -# Even if they're optional and not enabled. This prevents that. -exclude = [ - "embedded-hal-async", - "embedded-io-async", -] \ No newline at end of file diff --git a/embedded-hal-async/Cargo.toml b/embedded-hal-async/Cargo.toml index 231f00e2d..e14722974 100644 --- a/embedded-hal-async/Cargo.toml +++ b/embedded-hal-async/Cargo.toml @@ -12,7 +12,7 @@ name = "embedded-hal-async" readme = "README.md" repository = "https://github.com/rust-embedded/embedded-hal" version = "1.0.0-rc.2" -rust-version = "1.65.0" +rust-version = "1.75" [features] defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03"] diff --git a/embedded-hal-async/README.md b/embedded-hal-async/README.md index 2f739993a..39440d5c7 100644 --- a/embedded-hal-async/README.md +++ b/embedded-hal-async/README.md @@ -23,15 +23,10 @@ or a console to operate either on hardware serial ports or on virtual ones like ## Minimum Supported Rust Version (MSRV) -This crate requires Rust nightly newer than `nightly-2022-11-22`, due to requiring support for -`async fn` in traits (AFIT), which is not stable yet. +This crate is guaranteed to compile on stable Rust 1.75 and up. It *might* +compile with older versions but that may change in any new patch release. -Keep in mind Rust nightlies can make backwards-incompatible changes to unstable features -at any time. If this happens, we might do changes that increase the minimum required nightly -version in any patch release. - -When AFIT becomes stable, MSRV will be bumped to the Rust version that stabilizes it, after which -point the [standard MSRV bump policy](../docs/msrv.md) will apply. +See [here](../docs/msrv.md) for details on how the MSRV may be upgraded. ## License diff --git a/embedded-hal-bus/README.md b/embedded-hal-bus/README.md index d0b9bbdb6..3cfae9448 100644 --- a/embedded-hal-bus/README.md +++ b/embedded-hal-bus/README.md @@ -41,6 +41,8 @@ compile with older versions but that may change in any new patch release. See [here](../docs/msrv.md) for details on how the MSRV may be upgraded. +Enabling the `async` Cargo features requires Rust 1.75 or higher. + ## License Licensed under either of diff --git a/embedded-hal/Cargo.toml b/embedded-hal/Cargo.toml index a26ae3372..fcc145e74 100644 --- a/embedded-hal/Cargo.toml +++ b/embedded-hal/Cargo.toml @@ -8,7 +8,7 @@ categories = ["asynchronous", "embedded", "hardware-support", "no-std"] description = " A Hardware Abstraction Layer (HAL) for embedded systems " documentation = "https://docs.rs/embedded-hal" edition = "2021" -rust-version = "1.56" +rust-version = "1.60" keywords = ["hal", "IO"] license = "MIT OR Apache-2.0" name = "embedded-hal" diff --git a/embedded-io-adapters/README.md b/embedded-io-adapters/README.md index 6edd3c47b..a069d1fac 100644 --- a/embedded-io-adapters/README.md +++ b/embedded-io-adapters/README.md @@ -34,10 +34,7 @@ compile with older versions but that may change in any new patch release. See [here](../docs/msrv.md) for details on how the MSRV may be upgraded. -Enabling any of the `tokio-*` or `futures-*` Cargo features requires Rust nightly newer than -`nightly-2022-11-22`, due to requiring support for `async fn` in traits (AFIT), -which is not stable yet. Keep in mind Rust nightlies can make backwards-incompatible -changes to unstable features at any time. +Enabling any of the `tokio-*` or `futures-*` Cargo features requires Rust 1.75 or higher. ## License diff --git a/embedded-io-async/Cargo.toml b/embedded-io-async/Cargo.toml index 87891795c..6cd60c9c7 100644 --- a/embedded-io-async/Cargo.toml +++ b/embedded-io-async/Cargo.toml @@ -2,6 +2,7 @@ name = "embedded-io-async" version = "0.6.1" edition = "2021" +rust-version = "1.75" description = "Async embedded IO traits" repository = "https://github.com/rust-embedded/embedded-hal" readme = "README.md" diff --git a/embedded-io-async/README.md b/embedded-io-async/README.md index 6e6ddf18a..744f6e6f2 100644 --- a/embedded-io-async/README.md +++ b/embedded-io-async/README.md @@ -18,11 +18,10 @@ This project is developed and maintained by the [HAL team](https://github.com/ru ## Minimum Supported Rust Version (MSRV) -This crate requires Rust nightly newer than `nightly-2022-11-22`, due to requiring support for -`async fn` in traits (AFIT), which is not stable yet. +This crate is guaranteed to compile on stable Rust 1.75 and up. It *might* +compile with older versions but that may change in any new patch release. -Keep in mind Rust nightlies can make backwards-incompatible changes to unstable features -at any time. +See [here](../docs/msrv.md) for details on how the MSRV may be upgraded. ## License