language: rust
rust:
  - 1.31.0
os:
  - osx
  - linux
install:
  - rustup toolchain install nightly-2018-12-06
  - rustup component add rustfmt-preview --toolchain nightly-2018-12-06
  - rustup component add clippy-preview --toolchain nightly-2018-12-06
before_script:
  - cargo fetch --verbose
script:
  - cargo +nightly-2018-12-06 fmt -- --check || TEST_FAILED=true
  - test $TEST_FAILED || cargo +nightly-2018-12-06 clippy --all-targets --all-features -- -D warnings || TEST_FAILED=true
  - test $TEST_FAILED || RUST_BACKTRACE=1 cargo check || TEST_FAILED=true
  - test $TEST_FAILED || RUST_BACKTRACE=1 cargo test --verbose --all || TEST_FAILED=true
  - "! test $TEST_FAILED"
cache:
  cargo: true
  directories:
    - "$HOME/.rustup"
before_cache:
  - rm -rf $HOME/.cargo/registry
  - rm -rf $TRAVIS_BUILD_DIR/target
git:
  depth: 1
