Skip to content

Instantly share code, notes, and snippets.

@DD5HT
Last active July 13, 2018 20:01
Show Gist options
  • Save DD5HT/2c393c971ce110fd3116a62f20590f39 to your computer and use it in GitHub Desktop.
Save DD5HT/2c393c971ce110fd3116a62f20590f39 to your computer and use it in GitHub Desktop.
Using Travis CI to create publish multi target code.
os:
- linux
language: rust
rust:
- nightly
cache:
- apt
matrix:
include:
- env:
- NAME=YOURPACKETNAME
- TARGET=arm-unknown-linux-gnueabihf
- LINKER=arm-linux-gnueabihf-gcc
- PACKAGE=$NAME-rpi2.tar.gz
addons:
apt:
packages: &armhf
- gcc-arm-linux-gnueabihf
- libc6-armhf-cross
- libc6-dev-armhf-cross
- env:
- NAME=YOURPACKETNAME
- TARGET=armv7-unknown-linux-gnueabihf
- LINKER=arm-linux-gnueabihf-gcc
- PACKAGE=$NAME-rpi3.tar.gz
addons:
apt:
packages: *armhf
- env:
- NAME=YOURPACKETNAME
- TARGET=i686-unknown-linux-gnu
- PACKAGE=$NAME-i686.tar.gz
addons:
apt:
packages:
- gcc-multilib
- env:
- NAME=YOURPACKETNAME
- TARGET=x86_64-unknown-linux-gnu
- PACKAGE=$NAME-x86_64.tar.gz
install:
- export PATH="$PATH:$HOME/.cargo/bin"
- rustup target add $TARGET || true
- |
if [ -n "$LINKER" ]; then
mkdir -p ~/.cargo
echo >> ~/.cargo/config
echo "[target.$TARGET]" >> ~/.cargo/config
echo "linker = \"$LINKER\"" >> ~/.cargo/config
fi
script:
- |
if [ $TARGET = "x86_64-unknown-linux-gnu" ]; then
cargo test
fi
- cargo build --target $TARGET --verbose --release
before_deploy:
- tar -czf $PACKAGE -C target/$TARGET/release/ $NAME
deploy:
deploy:
provider: releases
api_key:
secure: YOUR SECURITY KEY
file: ${PACKAGE}
skip_cleanup: true
on:
tags: true
repo: YOURREPONAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment