Skip to content

Commit ada0df2

Browse files
committed
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`.
1 parent 92963eb commit ada0df2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,13 @@ jobs:
128128
# check no-std compatibility across dependencies
129129
cd no-std-check
130130
cargo check --verbose --color always
131-
cd ..
131+
- name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
132+
if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
133+
run: |
134+
cd no-std-check
135+
rustup target add thumbv7m-none-eabi
136+
sudo apt-get -y install gcc-arm-none-eabi
137+
cargo build --target=thumbv7m-none-eabi
132138
- name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
133139
if: "matrix.build-no-std && matrix.coverage"
134140
run: |

no-std-check/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#![no_std]

0 commit comments

Comments
 (0)