Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Action to test for no_std #45

Open
vadixidav opened this issue Feb 19, 2020 · 2 comments
Open

Action to test for no_std #45

vadixidav opened this issue Feb 19, 2020 · 2 comments

Comments

@vadixidav
Copy link

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

@svartalf
Copy link
Member

Hi, @vadixidav and thank you :)

I'm not quite following on what are you proposing to add?

  1. 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
  2. First update mentions thumbv6m-none-eabi option; you can either install it as a default toolchain with actions-rs/toolchain Action or simply by running rustup target add thumbv6m-none-eabi (after executing actions-rs/toolchain, as it will guarantee that you will have rustup in your PATH)
  3. 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 executes cargo install cargo-nono first and compilation takes some time, obviously. This problem will be fixed with Caching tracking issue meta#21, but for now it is what it is.

@vadixidav
Copy link
Author

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants