Cross Platform build testing

Hi Rustaceans,

I am building a small CLI interface for an API. Here's the current code I have: GitHub - AliSajid/iptmnet_client: A lightweight CLI tool to access the iPTMNet API built in rust.

In my github actions, I am running builds across four rust versions (stable, beta, nightly and my MSRV==1.57.0) across the three platforms I'm targeting (windows, mac and linux).

My question is this: Is that necessary, given the ability to do cross compilation? Should I be running these 12 builds across the three platforms or can I just use three different toolchains on the same (say linux) runner on Github.

Cross-compilation is possible (sometimes) but it is not the easier option — rustc is capable of cross-compilation but you still need a linker and libraries for the target platform. And using cross-compilation won't save very much CPU time because you still need to compile the project for each platform. The only costs you'd avoid are starting up the CI runner on each platform.

Stick with what you've got — it is much more straightforward to keep working.

1 Like