Skip to content

Commit

Permalink
Use targets in .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ilai-deutel committed Feb 13, 2020
1 parent 8d52c5b commit 7ae62ef
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
47 changes: 27 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
dist: bionic
language: rust
dist: bionic

rust:
- stable
- beta
- nightly

os:
- linux
- osx
env:
global:
- HOST=x86_64-unknown-linux-gnu

jobs:
allow_failures:
- rust: nightly
fast_finish: true
include:
# Linux
- env: TARGET=x86_64-unknown-linux-gnu
- env: TARGET=x86_64-unknown-linux-musl
- env: TARGET=i686-unknown-linux-gnu

# OSX
- env: TARGET=x86_64-apple-darwin
os: osx

# Testing other channels
- env: TARGET=x86_64-unknown-linux-gnu
rust: nightly
- env: TARGET=x86_64-apple-darwin
os: osx
rust: nightly

# Static checks
- name: "LoC and style tests"
before_script: rustup component add rustfmt clippy
script:
- cargo test --test loc
- cargo fmt -- --check
- cargo clippy --all-targets -- -D warnings
rust: stable
os: linux
- name: "Dependency Audit"
install: cargo install cargo-audit
script: cargo audit
cache: cargo
rust: stable
os: linux

before_install:
- set -e
- rustup self update
allow_failures:
- rust: nightly
fast_finish: true

before_install: ci/before_install.sh

cache: false

install: cargo build --verbose
install: cargo build --target "${TARGET:-$HOST}" --verbose

script: skip
16 changes: 16 additions & 0 deletions ci/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -euxo pipefail

if [ "$TRAVIS_OS_NAME" == linux ] && [ "$HOST" != "${TARGET:-$HOST}" ]; then
case "$TARGET" in
'i686-unknown-linux-gnu')
sudo apt-get update
sudo apt-get install -y gcc-multilib
;;
esac

rustup target add "$TARGET";
fi

rustup self update

0 comments on commit 7ae62ef

Please sign in to comment.