Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revamp Travis CI integration
Based on similar change in gimli.
  • Loading branch information
philipc committed Jan 14, 2018
1 parent 4217ae2 commit 9a9ae5e
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 25 deletions.
62 changes: 37 additions & 25 deletions .travis.yml
@@ -1,10 +1,17 @@
language: rust
cache: cargo

# use a more up-to-date Travis environment
dist: trusty
sudo: false

addons:
apt:
packages:
- binutils

before_script:
- export RUST_BACKTRACE=1

script: ./ci/script.sh

os:
- linux
- osx
Expand All @@ -14,26 +21,31 @@ rust:
- beta
- stable

addons:
apt:
packages:
- libssl-dev

script:
- cargo clean
- cargo build --no-default-features
- cargo build --no-default-features --features "cpp_demangle"
- cargo build --no-default-features --features "rustc-demangle"
- cargo build
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
cargo test;
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
cargo bench;
fi
env:
- GIMLI_JOB="test" GIMLI_PROFILE=
- GIMLI_JOB="test" GIMLI_PROFILE="--release"
- GIMLI_JOB="build" GIMLI_PROFILE="--no-default-features"
- GIMLI_JOB="build" GIMLI_PROFILE="--no-default-features" GIMLI_FEATURES="cpp_demangle"
- GIMLI_JOB="build" GIMLI_PROFILE="--no-default-features" GIMLI_FEATURES="rustc-demangle"

after_success:
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == "stable" ]]; then
bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh);
cargo tarpaulin --verbose --no-count --ciserver travis-ci --coveralls $TRAVIS_JOB_ID;
fi
matrix:
fast_finish: true
exclude:
# Testing needs addr2line
- os: osx
env: GIMLI_JOB="test" GIMLI_PROFILE=
- os: osx
env: GIMLI_JOB="test" GIMLI_PROFILE="--release"
include:
# Coverage should only run on Linux and stable Rust.
- rust: stable
os: linux
sudo: required
env: GIMLI_JOB="coverage" GIMLI_PROFILE=
# Building docs only needs to happen on one os and only on stable.
- rust: stable
os: linux
env: GIMLI_JOB="doc" GIMLI_PROFILE=
# Benching should only happen on nightly with --release.
- rust: nightly
env: GIMLI_JOB="bench" GIMLI_PROFILE="--release"
37 changes: 37 additions & 0 deletions ci/script.sh
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -ex

case "$GIMLI_JOB" in
"build")
cargo build $GIMLI_PROFILE --features "$GIMLI_FEATURES"
;;

"test")
cargo build $GIMLI_PROFILE --features "$GIMLI_FEATURES"
cargo test $GIMLI_PROFILE --features "$GIMLI_FEATURES"
;;

"doc")
cargo doc
;;

"bench")
cargo bench
;;

"coverage")
bash <(curl "https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh");
cargo tarpaulin --verbose --no-count --ciserver travis-ci --coveralls "$TRAVIS_JOB_ID";
;;

"cross")
rustup target add $TARGET
cargo install cross --force
cross test --target $TARGET $GIMLI_PROFILE --features "$GIMLI_FEATURES"
;;

*)
echo "Error! Unknown \$GIMLI_JOB: $GIMLI_JOB"
exit 1
esac

0 comments on commit 9a9ae5e

Please sign in to comment.