Building a Rust Project
What this guide covers
Supported Rust versions
Travis CI supports all three release channels of Rust: stable, beta, and nightly. Furthermore, you can test against a specific Rust release by using its version number.
Travis CI also installs the appropriate language tools that come with each Rust version.
As of Rust 1.16.0, these include
Choosing a Rust version
By default, we download and install the latest stable Rust release at the start of the build. If you’re just testing stable, this is all that you need:
The Rust version that is specified in the .travis.yml is available during the
build in the
TRAVIS_RUST_VERSION environment variable.
You can also test against a particular Rust release:
language: rust rust: - 1.0.0 - 1.1.0
The Rust team appreciates testing against the
nightly channels, even if you
are only targeting stable. A full configuration looks like this:
language: rust rust: - stable - beta - nightly matrix: allow_failures: - rust: nightly
This will test all three channels, but any breakage in nightly will not fail your overall build.
Default test script
Travis CI uses Cargo to run your build and tests by default. The exact commands run are:
$ cargo build --verbose $ cargo test --verbose
If you wish to override this, you can use the
language: rust script: make all
For example, if your project is a workspace,
you should pass
-all to the build commands to build and test all of the member crates:
language: rust script: - cargo build --verbose --all - cargo test --verbose --all