Continuous integration -- Multiple platforms?

I spent some time playing with continuous integration with different services.
I run with following versions:

  • Stable
  • Beta
  • Nightly
  • Minimum Supported Rust Version (MSRV)

I run following commands:

  • cargo build
  • cargo test
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings

The rust compiler rustc and cargo do the heavy lifting to make sure my code compile independently of the os/architecture.

However, is it necessary to run each version/commands on each OS ([linux, osx, windows]) and/or architectures (amd64/arm64) ?

For example, suppose I didn't write a piece of code hardly dependent to specific OS features or architecture.
If my cargo build and cargo test steps passed on linux/amd64 should I build on other platforms or can I trust the rust compiler to work everywhere?
Are cargo clippy and cargo fmt architecture/OS dependent ? If checks passed on linux/amd64 can I be confident clippy/rustfmt won't throw errors/warning on other platforms ?

Thanks for reading

EDIT:
The main goal is to not overstay on CI runners if running the specified commands will not raise any errors if they passed on one architecture/OS already.

A dependency of yours may depend on a specific OS, or work slightly different on different OSes.

cargo fmt is should return the same result on all systems I think. cargo clippy may return different results on different systems, but unless you are writing platform dependent code yourself, this will be unlikely.

You should probably run cargo build and cargo test on all systems, and cargo fmt and cargo clippy just on one system.

1 Like

:pray: Thanks for your answer it seems to be the best of both world to separate these commands in 2 groups.

One follow-up question:
The clippy repository recommends the following command on CI server:

$ cargo clippy --all-targets --all-features -- -D warnings

This command checks all my code (main, lib, unit-test, integration-test, doc-tests) but do it recursively on all dependency.
If I drop arguments --all-targets --all-features clippy just check my main/lib.
Is it possible to check all my code including unit-test/integration-test and excluding dependencies ?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.