From: Matt Corallo Date: Thu, 6 Oct 2022 15:44:03 +0000 (+0000) Subject: Test a full `no-std` build in the `no-std-check` crate in CI X-Git-Tag: v0.0.112~17^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2022-10-rgs-no-std;p=rust-lightning 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`. --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a48ecc74..799d22a6 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 e69de29b..0c9ac1ac 100644 --- a/no-std-check/src/lib.rs +++ b/no-std-check/src/lib.rs @@ -0,0 +1 @@ +#![no_std]