Skip to content

Commit 03e6868

Browse files
authored
CI: test build on actual no_std platforms (#67)
1 parent 802319d commit 03e6868

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

.github/workflows/rustls-rustcrypto.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@ env:
1717
RUSTFLAGS: "-Dwarnings"
1818

1919
jobs:
20-
build:
21-
strategy:
22-
matrix:
23-
toolchain:
24-
- 1.75.0 # MSRV
25-
- stable
26-
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@v4
29-
- uses: RustCrypto/actions/cargo-cache@master
30-
- uses: dtolnay/rust-toolchain@master
31-
with:
32-
toolchain: ${{ matrix.toolchain }}
33-
- run: cargo build
34-
- name: Test no_std with alloc build
35-
run: cargo build --no-default-features --features tls12,alloc
36-
3720
clippy:
3821
runs-on: ubuntu-latest
3922
steps:
@@ -63,10 +46,30 @@ jobs:
6346
components: rustfmt
6447
- run: cargo fmt --all -- --check
6548

49+
no_std:
50+
runs-on: ubuntu-latest
51+
strategy:
52+
matrix:
53+
rust:
54+
- 1.75.0 # MSRV
55+
- stable
56+
target:
57+
- armv7a-none-eabi
58+
- thumbv7em-none-eabi
59+
- wasm32-unknown-unknown
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@master
63+
with:
64+
toolchain: ${{ matrix.rust }}
65+
targets: ${{ matrix.target }}
66+
- run: cargo build --no-default-features --features tls12,alloc --release --target ${{ matrix.target }}
67+
6668
test:
6769
strategy:
6870
matrix:
6971
toolchain:
72+
- 1.75.0 # MSRV
7073
- stable
7174
runs-on: ubuntu-latest
7275
steps:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ categories = ["cryptography", "no-std"]
1313
keywords = ["rustls", "tls"]
1414
edition = "2021"
1515
rust-version = "1.75"
16+
resolver = "1" # Hack to enable the `custom` feature of `getrandom`
1617

1718
# Ensure all dependencies + feats are mapped to crate features for correct usage
1819
# default features often have std breaking no_std and potentially other unwanted
@@ -40,6 +41,9 @@ signature = { version = "2.1.0", default-features = false }
4041
webpki = { package = "rustls-webpki", version = "0.102.0", default-features = false }
4142
x25519-dalek = { version = "2", default-features = false }
4243

44+
[dev-dependencies]
45+
getrandom = { version = "0.2", features = ["custom"] } # workaround to build on no_std targets
46+
4347
[features]
4448
default = ["std", "tls12", "zeroize"]
4549
logging = ["rustls/logging"]

0 commit comments

Comments
 (0)