From 03e686892b395a7d5201bf5ae76d5d42f3dabd08 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 24 Apr 2024 10:12:28 -0600 Subject: [PATCH] CI: test build on actual `no_std` platforms (#67) --- .github/workflows/rustls-rustcrypto.yml | 37 +++++++++++++------------ Cargo.lock | 1 + Cargo.toml | 4 +++ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rustls-rustcrypto.yml b/.github/workflows/rustls-rustcrypto.yml index e76faf0..826ca38 100644 --- a/.github/workflows/rustls-rustcrypto.yml +++ b/.github/workflows/rustls-rustcrypto.yml @@ -17,23 +17,6 @@ env: RUSTFLAGS: "-Dwarnings" jobs: - build: - strategy: - matrix: - toolchain: - - 1.75.0 # MSRV - - stable - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: RustCrypto/actions/cargo-cache@master - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain }} - - run: cargo build - - name: Test no_std with alloc build - run: cargo build --no-default-features --features tls12,alloc - clippy: runs-on: ubuntu-latest steps: @@ -63,10 +46,30 @@ jobs: components: rustfmt - run: cargo fmt --all -- --check + no_std: + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - 1.75.0 # MSRV + - stable + target: + - armv7a-none-eabi + - thumbv7em-none-eabi + - wasm32-unknown-unknown + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + targets: ${{ matrix.target }} + - run: cargo build --no-default-features --features tls12,alloc --release --target ${{ matrix.target }} + test: strategy: matrix: toolchain: + - 1.75.0 # MSRV - stable runs-on: ubuntu-latest steps: diff --git a/Cargo.lock b/Cargo.lock index 0255f28..bf81148 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -694,6 +694,7 @@ dependencies = [ "digest", "ecdsa", "ed25519-dalek", + "getrandom", "hmac", "p256", "p384", diff --git a/Cargo.toml b/Cargo.toml index 985721c..c4f5481 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ categories = ["cryptography", "no-std"] keywords = ["rustls", "tls"] edition = "2021" rust-version = "1.75" +resolver = "1" # Hack to enable the `custom` feature of `getrandom` # Ensure all dependencies + feats are mapped to crate features for correct usage # default features often have std breaking no_std and potentially other unwanted @@ -40,6 +41,9 @@ signature = { version = "2.1.0", default-features = false } webpki = { package = "rustls-webpki", version = "0.102.0", default-features = false } x25519-dalek = { version = "2", default-features = false } +[dev-dependencies] +getrandom = { version = "0.2", features = ["custom"] } # workaround to build on no_std targets + [features] default = ["std", "tls12", "zeroize"] logging = ["rustls/logging"]