Incorporate TARGET in the install and build step

- Tidying up the build matrix
  - All channels has TARGET env var
  - Build against this targets:
    - x86_64-unknown-linux-gnu
    - x86_64-unknown-linux-musl
    - i686-unknown-linux-gnu
    - i686-unknown-linux-musl
    - x86_64-apple-darwin
  - Code formating check has it's own item in the build matrix
- Prevent target re-add error from rustup
- Incorporate the TARGET env var in the `install` and `script` stage
This commit is contained in:
Adit Cahya Ramadhan 2017-10-19 11:47:35 +07:00 committed by David Peter
parent ddfa0873fb
commit f7f5192139
1 changed files with 70 additions and 18 deletions

View File

@ -7,41 +7,54 @@ matrix:
# Stable channel.
- os: linux
rust: stable
before_script:
- export PATH="$PATH:$HOME/.cargo/bin"
- which rustfmt || cargo install rustfmt
script:
- cargo fmt -- --write-mode=diff
- cargo build
- cargo test
env: TARGET=x86_64-unknown-linux-gnu
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-musl
- os: linux
rust: stable
env: TARGET=i686-unknown-linux-gnu
- os: linux
rust: stable
env: TARGET=i686-unknown-linux-musl
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin
# Beta channel.
- os: linux
rust: beta
env: TARGET=x86_64-unknown-linux-gnu
- os: linux
rust: beta
env: TARGET=x86_64-unknown-linux-musl
- os: linux
rust: beta
env: TARGET=x86_64-unknown-linux-gnu
env: TARGET=i686-unknown-linux-gnu
- os: linux
rust: beta
env: TARGET=i686-unknown-linux-musl
- os: osx
rust: beta
env: TARGET=x86_64-apple-darwin
# Nightly channel.
- os: linux
rust: nightly
before_script:
- export PATH="$PATH:$HOME/.cargo/bin"
- which rustfmt || cargo install rustfmt-nightly
script:
- cargo fmt -- --write-mode=diff
- cargo build
- cargo test
- os: linux
rust: nightly
env: TARGET=i686-unknown-linux-musl
env: TARGET=x86_64-unknown-linux-gnu
- os: linux
rust: nightly
env: TARGET=x86_64-unknown-linux-musl
- os: linux
rust: nightly
env: TARGET=i686-unknown-linux-gnu
- os: linux
rust: nightly
env: TARGET=i686-unknown-linux-musl
- os: osx
rust: nightly
env: TARGET=x86_64-apple-darwin
# Minimum Rust supported channel.
- os: linux
rust: 1.19.0
@ -49,10 +62,49 @@ matrix:
- os: linux
rust: 1.19.0
env: TARGET=x86_64-unknown-linux-musl
- os: linux
rust: 1.19.0
env: TARGET=i686-unknown-linux-gnu
- os: linux
rust: 1.19.0
env: TARGET=i686-unknown-linux-musl
- os: osx
rust: 1.19.0
env: TARGET=x86_64-apple-darwin
# Code formatting check
- os: linux
rust: stable
# skip the global install step
install: which rustfmt || cargo install rustfmt
script: cargo fmt -- --write-mode=diff
- os: linux
rust: nightly
# skip the global install step
install: which rustfmt || cargo install rustfmt-nightly
script: cargo fmt -- --write-mode=diff
addons:
apt:
packages:
# needed for i686-unknown-linux-gnu target
- gcc-multilib
env:
global:
# Default target on travis-ci.
# Used as conditional check in the install stage
- HOST=x86_64-unknown-linux-gnu
install:
# prevent target re-add error from rustup
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
script:
# Incorporate TARGET env var to the build and test process
- cargo build --target $TARGET --verbose
- cargo test --target $TARGET --verbose
notifications:
email:
on_success: never