From 45ec577c2f58a53f85e56c57c7a330977adafad5 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 27 Nov 2023 17:42:25 +0100 Subject: [PATCH] CI: check no-std support --- .github/workflows/rust.yml | 15 +++++++++++++++ .gitignore | 1 + no-std-support-check/Cargo.toml | 13 +++++++++++++ no-std-support-check/src/lib.rs | 3 +++ 4 files changed, 32 insertions(+) create mode 100644 no-std-support-check/Cargo.toml create mode 100644 no-std-support-check/src/lib.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c1ed261..0524b83 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -108,3 +108,18 @@ jobs: version: latest - name: Fuzz Base w/ RustCrypto run: cargo fuzz run base -- -runs=10000 + + no-std-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # we use a target that lacks a pre-compiled libstd to check if any dependency is using libstd + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: thumbv7em-none-eabihf + default: true + - name: Fuzz Base w/ RustCrypto + run: cargo check --target thumbv7em-none-eabihf + working-directory: no-std-support-check diff --git a/.gitignore b/.gitignore index 20b656e..2c39f9c 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ Cargo.lock **/*.rs.bk .vscode/ evercrypt_provider/target +no-std-support-check/target rust_crypto_provider/target traits/target/ .DS_Store diff --git a/no-std-support-check/Cargo.toml b/no-std-support-check/Cargo.toml new file mode 100644 index 0000000..4b04f9f --- /dev/null +++ b/no-std-support-check/Cargo.toml @@ -0,0 +1,13 @@ +[package] +edition = "2021" +name = "no-std-support-check" +publish = false +version = "0.0.0" + +[dependencies] +hpke-rs-crypto = { path = "../traits" } + +# the no-std-support-check CI job uses the `thumbv7em-none-eabihf` target +# `getrandom` does not support that target out of box so this feature needs to be enabled to avoid a compilation error +# (normally this feature should NOT be enabled in a library but this crate is just used for a CI check) +getrandom = { version = "0.2.11", features = ["custom"] } diff --git a/no-std-support-check/src/lib.rs b/no-std-support-check/src/lib.rs new file mode 100644 index 0000000..f3edcff --- /dev/null +++ b/no-std-support-check/src/lib.rs @@ -0,0 +1,3 @@ +//! used in CI to check that crates are no-std compatible + +#![no_std]