Skip to content

Commit

Permalink
Add a step to the CI to make sure the crate builds properly on #![no_…
Browse files Browse the repository at this point in the history
…std] platforms.
  • Loading branch information
Lymia committed May 8, 2023
1 parent 746a137 commit 5d9eccd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ jobs:
with:
command: test
args: ${{ matrix.args }}
build_no_std:
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: thumbv6m-none-eabi
default: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --target thumbv6m-none-eabi -p enumset_test_no_std
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"enumset",
"enumset_derive",
"enumset_test_no_std",
]

[profile.release]
Expand Down
9 changes: 9 additions & 0 deletions enumset_test_no_std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "enumset_test_no_std"
version = "0.0.0"
edition = "2021"

description = "DO NOT PUBLISH"

[dependencies]
enumset = { path = "../enumset" }
26 changes: 26 additions & 0 deletions enumset_test_no_std/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![no_std]
#![feature(start)]

use core::panic::PanicInfo;
use enumset::*;

#[derive(EnumSetType)]
pub enum SmallEnum {
A,
B,
C,
}

#[start]
fn main(_: isize, _: *const *const u8) -> isize {
let e = SmallEnum::A | SmallEnum::B;
if e.contains(SmallEnum::C) {
panic!("oh no!");
}
0
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}

0 comments on commit 5d9eccd

Please sign in to comment.