Compile and test a Rust application
Using Codefresh pipelines
Codefresh can work with any Rust application very easily as both
cargo are already offered in Dockerhub.
The example Rust project
You can see the example project at https://github.com/codefresh-contrib/rust-sample-app. The repository contains a Rust starter project with a dummy unit test.
cargo buildcompiles the code.
cargo testruns unit tests
cargo cleanremoves artifacts and binaries.
Create a CI pipeline for Rust applications
Creating a CI/CD pipeline for Rust is very easy, because Codefresh can run any Rust image that you wish. Rust docker images already contain the
cargo package manager.
Here is the full pipeline that compiles the application after checking out the code.
This pipeline clones the source code, compiles the code and runs unit tests. In all cases we use the public Docker image of Rust that also contains
We also pass the
CARGO_HOME environment variable to place the Cargo cache on the shared Codefresh volume. See the Caching documentation for more details.
Codefresh YAML for pipeline definitions
Steps in pipelines
How Codefresh pipelines work