language: rust
sudo: required
dist: trusty
addons:
    apt:
        packages:
            - libssl-dev
cache: cargo
rust:
# Waiting for multiple features
#  - stable
#  - beta
  - nightly
matrix:
  allow_failures:
    - rust: beta

before_cache: |
  if [[ "$TRAVIS_RUST_VERSION" == nightly ]]; then
    RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install --force cargo-tarpaulin
  fi

script:
- cargo clean
- cargo build
- cargo test

after_success: |
  if [[ "$TRAVIS_RUST_VERSION" == nightly ]]; then
    cargo tarpaulin --out Xml
    bash <(curl -s https://codecov.io/bash)
  fi
