From ada0df2d9ff429a252656cc460e002895f686f11 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 6 Oct 2022 15:44:03 +0000 Subject: [PATCH] Test a full `no-std` build in the `no-std-check` crate in CI Rust is incredibly forgiving in attempts to access `std`, making it rather difficult to test `no-std` properly. In practice, the only decent way to do so is to actually build for a platform that does not have `std`, which we do here by building the `no-std-check` crate for `arm-thumbv7m-none-eabi`. --- .github/workflows/build.yml | 8 +++++++- no-std-check/src/lib.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a48ecc743..799d22a64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -128,7 +128,13 @@ jobs: # check no-std compatibility across dependencies cd no-std-check cargo check --verbose --color always - cd .. + - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded + if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'" + run: | + cd no-std-check + rustup target add thumbv7m-none-eabi + sudo apt-get -y install gcc-arm-none-eabi + cargo build --target=thumbv7m-none-eabi - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation if: "matrix.build-no-std && matrix.coverage" run: | diff --git a/no-std-check/src/lib.rs b/no-std-check/src/lib.rs index e69de29bb..0c9ac1ac8 100644 --- a/no-std-check/src/lib.rs +++ b/no-std-check/src/lib.rs @@ -0,0 +1 @@ +#![no_std] -- 2.39.5