Skip to content

Commit e2d87ef

Browse files
committed
Check for no-std compatibility across dependencies
To ensure no-std is honored across dependencies, add a crate depending on lightning crates supporting no-std. This should ensure any regressions are caught. Otherwise, cargo doesn't seem to catch some incompatibilities (e.g., f64::log10 unavailable in core) and seemingly across other dependencies as describe here: https://blog.dbrgn.ch/2019/12/24/testing-for-no-std-compatibility/
1 parent e490672 commit e2d87ef

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ jobs:
122122
cargo test --verbose --color always --no-default-features --features no-std
123123
# check if there is a conflict between no-std and the default std feature
124124
cargo test --verbose --color always --features no-std
125+
# check no-std compatibility across dependencies
126+
cd ..
127+
cd no-std-check
128+
cargo check --verbose --color always
125129
cd ..
126130
- name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
127131
if: "matrix.build-no-std && matrix.coverage"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ lightning-c-bindings/a.out
88
Cargo.lock
99
.idea
1010
lightning/target
11+
no-std-check/target

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ members = [
99
"lightning-background-processor",
1010
]
1111

12+
exclude = [
13+
"no-std-check",
14+
]
15+
1216
# Our tests do actual crypo and lots of work, the tradeoff for -O1 is well worth it.
1317
# Ideally we would only do this in profile.test, but profile.test only applies to
1418
# the test binary, not dependencies, which means most of the critical code still

no-std-check/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "no-std-check"
3+
version = "0.1.0"
4+
edition = "2018"
5+
6+
[features]
7+
default = ["lightning/no-std", "lightning-invoice/no-std"]
8+
9+
[dependencies]
10+
lightning = { version = "0.0.105", path = "../lightning", default-features = false }
11+
lightning-invoice = { version = "0.13.0", path = "../lightning-invoice", default-features = false }

no-std-check/src/lib.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)