1env:
2  global:
3    - RUST_BACKTRACE=1
4    - PATH=$PATH:$HOME/.cargo/bin
5    - RUST_STABLE=1.26.2
6    - RUST_NIGHTLY=nightly-2018-06-10
7    - RUST_RUSTFMT=0.8.2
8    - RUST_CLIPPY=0.0.207
9os:
10  - linux
11  - osx
12language: rust
13rust:
14  - 1.26.2
15  - nightly-2018-06-10
16sudo: false
17branches:
18  only:
19    - master
20cache:
21  cargo: true
22  directories:
23    - $HOME/elfutils
24before_script:
25  - curl -sSL https://github.com/maidsafe/QA/raw/master/travis/cargo_install.sh > cargo_install.sh
26  - bash cargo_install.sh cargo-prune;
27  - if [ "$TRAVIS_RUST_VERSION" = "$RUST_NIGHTLY" ] && [ "$TRAVIS_OS_NAME" = linux ]; then
28      bash cargo_install.sh rustfmt-nightly "$RUST_RUSTFMT";
29      bash cargo_install.sh clippy "$RUST_CLIPPY";
30    fi
31script:
32  - if [ "${TRAVIS_RUST_VERSION}" = "$RUST_STABLE" ]; then
33      (
34        set -x;
35        cargo test --release --verbose
36      );
37    elif [ "${TRAVIS_OS_NAME}" = linux ]; then
38      (
39        set -x;
40        cargo fmt -- --check &&
41        cargo clippy && cargo clippy --profile=test
42      );
43    fi
44before_cache:
45  - cargo prune
46