Testing with multiple rustc versions and cargo features?


Hi everyone,

When developing a crate, you may want to support multiple version of rustc. You may also want to have multiple sets of features (like a normal version and a no-std one).

But then arises the need to test that. And especially the different combinations.

How do you deal with that ? What tool(s) do you use for that ? A simple bash script ?


I do it with https://docs.travis-ci.com/user/customizing-the-build#Build-Matrix


Provided you have a simple enough .travis.yml, you can use my test-matrix.py script to run the matrix locally. It automatically segregates different rustc versions, allowing you to keep the build artefacts as well as not having to recompile everything every time, and logs all the output.

Here’s an example .travis.yml for multiple versions and features from the conv crate.


I recently had a similar conundrum with bytecount. Perhaps you can adapt our .travis.yml for your needs?


I (also) use the travis build matrix for testing mhash on CI (and just test on nightly + default features when developing unless modifying one of the features or CI fails). You can see in that config how to also limit deployment tasks based on the build matrix. I used to have about 7 different feature sets that got tested, but running 21 builds on travis takes quite a while so I gave up and just reduced it to 3.