Skip to content

Commit

Permalink
CI: test build on actual no_std platforms (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri authored Apr 24, 2024
1 parent 802319d commit 03e6868
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/rustls-rustcrypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 03e6868

Please sign in to comment.