cargo
cargo copied to clipboard
Action to test for no_std
On all no_std supporting crates I typically need to test for no_std compatibility in CI. This blog has some useful advice on how this can be done. Is it possible this can be added here? Is this the right place? Thank you and much appreciated. I love actions-rs.
Here is a crate I am doing this as an example currently: https://github.com/rust-cv/eight-point
Hi, @vadixidav and thank you :)
I'm not quite following on what are you proposing to add?
- Transparently adding
ensure_no_std
crate as a dependency to the tested project seems like a way to introduce unexpected problems and in general seems like an overkill - First update mentions
thumbv6m-none-eabi
option; you can either install it as a default toolchain withactions-rs/toolchain
Action or simply by runningrustup target add thumbv6m-none-eabi
(after executingactions-rs/toolchain
, as it will guarantee that you will haverustup
in yourPATH
) - Second update uses
cargo-nono
tool, I'm using it too to ensure no-std compatibility (example). Unfortunately right now it adds overhead, as it executescargo install cargo-nono
first and compilation takes some time, obviously. This problem will be fixed with https://github.com/actions-rs/meta/issues/21, but for now it is what it is.
I was unable to get cargo-nono
to properly detect when std was pulled in, so I don't consider it to be robust enough for me.
thumbv6m-none-eabi
doesn't seem to work for me either because that precludes the use of dependencies that pull in std because Cargo.lock
gets automatically upgraded with the std
version of the dependencies. I was unable to find any way to get rid of my std
dependence in my dev-dependencies
. This is mentioned in the blog post as well.
As for ensure_no_std
, I feel like there might be some way to package this concept up into an action. I find myself putting this ensure_no_std
into several repositories, and the concept of detecting no_std
compliance should be pretty common in many rust libraries, but probably isn't today due to how prohibitive it is. I am hoping that actions-rs
might be able to add something to assist with this.
My proposal would vaguely be: an action that templates ensure_no_std
to contain the correct crate name and then runs the designated cargo command on the ensure_no_std
crate rather than the actual crate. I am not an expert at GitHub actions by any means, so I am not sure what is possible, but perhaps adding a flag such as ensure-no-std: true
to a cargo build command should be sufficient here to tell it to perform the cargo build on this templated crate in a subdirectory.
Does this seem reasonable?