Hendrik Teuber
Jul 13, 2018 · 2 min read

Multi target Rust builds with auto deployment in Travis-CI

Successful Travis Build

This is just a small build script to automatically compile and create Rust binaries for your i86 32 and 64 bit machine and your Raspberry Pi(ARM) with Travis-CI. On the right side I added a little explanation of the following script.

TLDR: Replace YOURPACKETNAME with your actual packet name. Add your YOUR SECRUITY KEY for auto deployment and specify YOURREPONAME.

We are using rust nightly in this case. You can also add more targets like stable or beta. We also use the apt cache, cargo cache is not possible here since the different targets are in conflict with each other. Now we specify NAME, TARGET, LINKER and the PACKAGE and add the compiler dependencies via apt. for each environment.

Install: Installs the TARGET via rustup and also adds the correct target to the cargo config.

Our actual compile script just runs cargo test for x86_64. All other targets are just built with the release and verbose flag.

If the compilation process is successful we get an .tar.gz archive with our finished binary. And if it’s a tagged release it automatically pushes the archives to the GitHub release page with the corresponding tag.

 $ git tag -a v1.4.2 
$ git push origin v1.4.2

Here a little info on how you can create your O-Auth token and a sample .travis.yml with the travis client in your repository.

$ travis setup releases

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store