From caa092c06e5d80da12c5dbb237af9f95ce0daa2b Mon Sep 17 00:00:00 2001 From: Finomnis Date: Thu, 30 May 2024 15:41:15 +0200 Subject: [PATCH 1/4] Fix min-versions; add min-version ci check --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++----- Cargo.toml | 4 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 231a1de..cad0fda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,19 +12,19 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: rustup component add rustfmt - name: Check library formatting uses: actions-rs/cargo@v1 with: command: fmt args: --verbose --all -- --check - + # For each chip, build and lint the main library clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -42,20 +42,42 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run unit and documentation tests uses: actions-rs/cargo@v1 with: command: test args: --verbose + # Check if dependency versions in Cargo.toml are updated correctly + min-versions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install nightly toolchain + uses: dtolnay/rust-toolchain@nightly + with: + targets: thumbv7em-none-eabihf + + - name: Install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: Install cargo-minimal-versions + uses: taiki-e/install-action@cargo-minimal-versions + + - name: Check with minimal versions + run: cargo minimal-versions check + + - name: Run tests with minimal versions + run: cargo minimal-versions test + # Make sure documentation builds, and doclinks are valid doc: env: RUSTDOCFLAGS: -D warnings runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Check documentation and doclinks uses: actions-rs/cargo@v1 with: diff --git a/Cargo.toml b/Cargo.toml index fa34463..7188a07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,9 @@ exclude = [ [dependencies] bitflags = "2" -cortex-m = "0.7" +cortex-m = "0.7.4" ral-registers = "0.1" -usb-device = "0.3" +usb-device = "0.3.1" [dependencies.defmt-03] package = "defmt" From cc612eec751af9a731fbc0b908777bba58e4b2e8 Mon Sep 17 00:00:00 2001 From: Finomnis Date: Thu, 30 May 2024 17:16:50 +0200 Subject: [PATCH 2/4] Also check optional dependencies in min-versions check --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cad0fda..a4f08d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: uses: taiki-e/install-action@cargo-minimal-versions - name: Check with minimal versions - run: cargo minimal-versions check + run: cargo minimal-versions check --all-features - name: Run tests with minimal versions run: cargo minimal-versions test From e7aa4b5ea163926a79b7e4d4ec643a82689c1927 Mon Sep 17 00:00:00 2001 From: Finomnis Date: Thu, 30 May 2024 17:29:53 +0200 Subject: [PATCH 3/4] Attempt to fix mystery CI error --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4f08d3..99c02e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,21 +55,24 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install nightly toolchain - uses: dtolnay/rust-toolchain@nightly + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable with: targets: thumbv7em-none-eabihf + - name: Install nightly toolchain + uses: dtolnay/rust-toolchain@nightly + - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack - name: Install cargo-minimal-versions uses: taiki-e/install-action@cargo-minimal-versions - name: Check with minimal versions - run: cargo minimal-versions check --all-features + run: cargo +stable minimal-versions check --all-features - name: Run tests with minimal versions - run: cargo minimal-versions test + run: cargo +stable minimal-versions test # Make sure documentation builds, and doclinks are valid doc: From 2a214dc7a5d2feb2b186c92a3ca37bc1d777123b Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Thu, 30 May 2024 11:25:16 -0400 Subject: [PATCH 4/4] Show version incompatibility with cortex-m The previous commits restrict which cortex-m versions a user can build with. This commit demonstrates the issue. From the root of the repo, run the build with cargo build --manifest-path i-need-min-cm/Cargo.toml i-need-min-cm represents a closed source user library. For reasons out of our control, that user really wants to use 0.7.0 of cortex-m. We _could_ allow imxrt-usbd to build with version 0.7.0. We've shown that it works. But we're not letting that build happen. --- .github/workflows/ci.yml | 17 +++++++++++++++++ Cargo.toml | 3 +++ i-need-min-cm/Cargo.toml | 7 +++++++ i-need-min-cm/src/lib.rs | 2 ++ 4 files changed, 29 insertions(+) create mode 100644 i-need-min-cm/Cargo.toml create mode 100644 i-need-min-cm/src/lib.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99c02e5..e11a916 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,23 @@ jobs: command: fmt args: --verbose --all -- --check + cortex-m-compat: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + target: thumbv7em-none-eabihf + override: true + profile: minimal + - name: Check cortex-m compatibility + uses: actions-rs/cargo@v1 + with: + command: build + args: --manifest-path i-need-min-cm/Cargo.toml + # For each chip, build and lint the main library clippy: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 7188a07..457bdd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,9 @@ optional = true [features] "defmt-03" = ["dep:defmt-03", "usb-device/defmt"] +[workspace] +exclude = ["i-need-min-cm"] + [package.metadata.docs.rs] default-target = "thumbv7em-none-eabihf" diff --git a/i-need-min-cm/Cargo.toml b/i-need-min-cm/Cargo.toml new file mode 100644 index 0000000..b868fef --- /dev/null +++ b/i-need-min-cm/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "i-need-min-cm" +version = "0.1.0" + +[dependencies] +cortex-m = "=0.7.0" +imxrt-usbd = { path = ".." } diff --git a/i-need-min-cm/src/lib.rs b/i-need-min-cm/src/lib.rs new file mode 100644 index 0000000..8cd3942 --- /dev/null +++ b/i-need-min-cm/src/lib.rs @@ -0,0 +1,2 @@ +use cortex_m as _; +use imxrt_usbd as _;