language: rust
sudo: false
matrix:
  include:
    - rust: 1.12.0
      before_script:
        # rand 0.4.2 requires rust 1.15, and rand-0.3.22 requires rand-0.4  :/
        # manually hacking the lockfile due to the limitations of cargo#2773
        - cargo generate-lockfile
        - sed -i -e 's/"rand 0.[34].[0-9]\+/"rand 0.3.20/' Cargo.lock
        - sed -i -e '/^name = "rand"/,/^$/s/version = "0.3.[0-9]\+"/version = "0.3.20"/' Cargo.lock
    - rust: 1.15.0
    - rust: stable
    - rust: beta
    - rust: nightly
      env:
       - BENCH=1
branches:
  only:
    - master
    # bors branches
    - staging
    - trying
script:
  - |
      cargo build --verbose --no-default-features &&
      cargo build --verbose --features "$FEATURES" &&
      cargo test --verbose --features "$FEATURES" &&
      ([ "$BENCH" != 1 ] || cargo bench --verbose --features "$FEATURES")
