-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test more conditions in GitHub actions #12
Comments
Hello! I was wondering if this still up for taking and if so whether you could explain the issue in a bit more detail (I'm also new to rust in general so I probably missed some stuff). From what I understand you want to:
I am not sure if running these in both stable and nightly (when applicable) changes anything. Also, have you considered using this for the MSRV? |
Hi @AntoniosBarotsis , thanks for offering! Yes, it's still open; feel free to assign it to yourself if you feel like taking it on! There are a few considerations here; I'll break them down by the "axes" I mentioned in the original comment: VersionWe want to make sure to test with different versions of the toolchain for a few reasons:
TargetsSome of our code is CPU architecture-specific. Notably, the
Cargo featuresWe want to make sure that every combination of Cargo features we support works (including enabling no features). Currently, those features are TestsWe want to run a few different tests:
Invalid combinationsNote that some combinations of these axes aren't valid. E.g., since the The taskWhat is required for this issue is to figure out how to write a GitHub Actions config file that will run every combination of these axes (except for the combinations that aren't valid), and ideally does it in an idiomatic way (e.g., we probably don't need to literally list every possible combination in the config file). I haven't ever written a GitHub Actions config file myself before, so unfortunately I can't provide much guidance on that front. However, from a bit of Googling, it looks like there is a lot of documentation on them, a lot of blog posts written about them (including specifically about using them for Rust tests, and even more specifically about using them for Rust tests which target other CPU architectures). Hopefully that detail helps! Feel free to ask any other questions you have 😃
I wasn't aware of that; thanks for the heads up! Apparently our MSRV is 1.51.0 😃 |
That's a nice initiative actually. I think I understood most of what you said, I'll go over everything tomorrow again as it is really late here. I was thinking of using Toast which helps a lot when testing the pipeline since you can run it locally but I'll see if that would work with the many config combinations you want (because I want each one of those combinations to be its own task, I think it is possible but I'll have to check tomorrow). I have used this once before, it is trivial to run this from Github Actions but being able to also run it locally is a massive help instead of pushing 10 times until your yml is formatted correctly. I think that's it for now, I'll probably start asking questions tomorrow when I start setting stuff up :) Edit: I don't think I can assign myself to the issue but yes I'll be working on this, wondering if you could also add a Hacktoberfest label to the merge request if you're happy with the end result 👀 |
Awesome, that all sounds great!
Done 😃
Sure! Feel free to remind me if I forget once you put up a PR. |
I dug a bit into how to do cross-compilation; hopefully this'll be helpful for you. First, you actually need to install a target, not a toolchain. If you install a toolchain, it'll assume you're actually running on that sort of machine (e.g., if you install a powerpc toolchain, it'll be a powerpc binary), and you'll get a lovely error like:
Instead, you can install a target using $ rustup target add aarch64-unknown-linux-gnu
$ cargo check --target=aarch64-unknown-linux-gnu Note that this seems not to play well with Cargo's toolchain selection mechanism. In particular, let's assume that you previously had your default toolchain set to nightly (which I did when I was trying this out). If you then run $ cargo +stable check --target=aarch64-unknown-linux-gnu
Compiling proc-macro2 v1.0.43
Compiling quote v1.0.21
Compiling unicode-ident v1.0.4
Compiling syn v1.0.99
Checking byteorder v1.4.3
error[E0463]: can't find crate for `core`
|
= note: the `aarch64-unknown-linux-gnu` target may not be installed
= help: consider downloading the target with `rustup target add aarch64-unknown-linux-gnu` What you need to do is specifically install the target for the toolchain you'll be using: $ rustup +stable target add aarch64-unknown-linux-gnu Putting that all together, if you're trying to run a given Cargo command (let's say $ rustup +$TOOLCHAIN target add $TARGET
$ cargo +$TOOLCHAIN check --target=$TARGET |
Ok so, this might be a bit easier than I thought. I haven't started working on this yet but I just added a workflow for a personal project I am working on and it turns out that using different channels is very easy and different compiler versions should be basically the exact same. Because of this, I will probably not need Toast. I did not know this but it is possible to make the workflow not fail if specific tasks fail which is great because nightly failures won't cause the entire workflow to be invalidated (but you can still see where and why they failed). Lastly, I keep forgetting you can add if checks to these workflows so ignoring the "invalid cases" that you mentioned should be fairly straightforward as well. You can most likely expect the first draft tonight! I'll try to provide a rough explanation of how stuff works when I start pushing since you haven't worked with Github Actions before. |
Awesome, thanks! By the way, heads up that we may not actually have any nightly-only code after all - it's possible that the [features]
fake-nightly = [] ...and in #![cfg_attr(feature = "fake-nightly", try_blocks)] |
Could you outline the exact targets that you want because I'm not sure what the differences between some of these are. You can check the available targets with The one I am currently using is Also I am currently trying to add |
I think that everything else is actually working fine. You can see the parameters I use here, the tests will be on all possible combinations of these. Let me know if I missed something. |
Moving the conversation over to the PR thread. |
Fixed in fa7e3e8. |
Use GitHub actions to test the following axes:
simd
andsimd-nightly
features, which emit impls for various architecture-specific types)cargo check
,cargo test
, andcargo miri test
Note that, depending on how we implement this, some combinations of the above may not be possible to run. E.g., if we run on an x86_64 machine, it may be possible to run
cargo miri test
while targeting powerpc (I'm not sure about this), but it definitely won't be possible to runcargo test
while targeting powerpc.As a possible stretch goal, also include a test to make sure that
README.md
is kept up to date (#18).The text was updated successfully, but these errors were encountered: