Skip to content

Conversation

@TimJentzsch
Copy link
Collaborator

@TimJentzsch TimJentzsch commented May 11, 2022

Closes #32.

This PR adds two new jobs to the CI workflow to cargo check and cargo test with the --no-default-features flag. Currently this has mainly the effect of enabling no_std.

Notably these currently throw errors, which just highlights the need to include it in CI.

I'm not sure if I'm able to resolve these errors as I've never worked with no_std before, but I can certainly try :)

Side note: Why do we have both cargo check and cargo test jobs? Wouldn't cargo test always fail if cargo check fails?

TODO:

⚠️ This is a breaking change! (I think) ⚠️

The fixes to the no-default-feature configuration is probably a breaking change.

@alice-i-cecile alice-i-cecile added the build system Make continuous integration do the tedious things label May 11, 2022
@alice-i-cecile
Copy link
Collaborator

alice-i-cecile commented May 11, 2022

Notably these currently throw errors, which just highlights the need to include it in CI.

Yeah, I saw an existing bug on stretch about this, and I'm very happy to see CI fail here.

I'm not sure if I'm able to resolve these errors as I've never worked with no_std before, but I can certainly try :)

Thanks a ton. Let us know if you get stuck on anything.

Why do we have both cargo check and cargo test jobs? Wouldn't cargo test always fail if cargo check fails?

As a reviewer, it can be quite useful to tell at a glance the current state of a PR. Tests failing is less severe than compilation failures, which are less severe than things like clippy or formatting violations.

@TimJentzsch
Copy link
Collaborator Author

Four of these errors are caused by a dependency upgrade which was part of #1. The heapless crate has removed the heapless::consts module (changelog), which is used multiple times when the alloc and std features are disabled.

Should we first downgrade heapless again and properly upgrade in a new issue/PR or should this be fixed here?

@TimJentzsch
Copy link
Collaborator Author

Two more errors are also caused by a dependency upgrade, arrayvec doesn't have the Array trait anymore and changed the ArrayVec definition.

@alice-i-cecile
Copy link
Collaborator

I'd like to fix these issues here; the dependency upgrade was good for other reasons, and the fix should be self-contained.

@mockersf
Copy link
Contributor

This PR adds two new jobs to the CI workflow to cargo check and cargo test with the --no-default-features flag. Currently this has mainly the effect of enabling no_std.

Could you also add those for --no-default-features --features alloc? It's the other feature that was tested by the original crate.

Side note: Why do we have both cargo check and cargo test jobs? Wouldn't cargo test always fail if cargo check fails?

I added the CI by copying this quickstart because I wanted something quick to setup to make sure tests would be kept green

@TimJentzsch TimJentzsch marked this pull request as draft May 13, 2022 10:09
@TimJentzsch TimJentzsch marked this pull request as ready for review May 13, 2022 11:16
@TimJentzsch
Copy link
Collaborator Author

This is now ready to review. Please take extra care while reviewing my fixes to the compile errors, I didn't really know what I was doing while converting the libraries to constant generics.

I think renaming the CI jobs also messed up the required checks, we might need to change the settings there (or change the names back).

@alice-i-cecile alice-i-cecile added the code quality Make the code cleaner or prettier. label May 13, 2022
Copy link
Collaborator

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great; that's a nice little application of const generics.

@TimJentzsch
Copy link
Collaborator Author

We probably need to bump a minor version for this, because it's probably a breaking change, right? Should I change the version in the Cargo.toml file or how is this usually handled?

@alice-i-cecile
Copy link
Collaborator

@TimJentzsch with respect to CI, I have two thoughts:

  1. We should just remove the check steps. It's too noisy with this many jobs.
  2. Once that's done, I can temporarily remove the need for CI to pass the renamed jobs, and then re-enable it for the new test tasks.

The test suits will still catch errors here, this many jobs make the CI too noisy.
@alice-i-cecile alice-i-cecile enabled auto-merge (squash) May 13, 2022 14:09
@alice-i-cecile alice-i-cecile merged commit 9eb3469 into DioxusLabs:master May 13, 2022
@TimJentzsch TimJentzsch deleted the 32-no_std-ci branch May 13, 2022 14:13
jkelleyrtp pushed a commit that referenced this pull request Oct 10, 2022
* Add GitHub Actions workflows for checking and testing with no default features

* Convert heapless constants to Rust constants

* Migrate arrayvec types to constant generics

* Remove arrayvec::Array trait usage

* Add CI with --no-default-features --features-alloc flags

* Remove cargo check jobs from CI

The test suits will still catch errors here, this many jobs make the CI too noisy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build system Make continuous integration do the tedious things code quality Make the code cleaner or prettier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CI for no_std compilation and tests

3 participants