language: rust

before_install:
  - curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf -

addons:
  apt:
    packages:
      - libudev-dev

rust:
  - stable
  - beta
  - nightly

jobs:
  include:
    - stage: Tests
      cache: cargo
      script: cargo test
    - stage: Coverage
      rust: nightly
      script:
        - export CARGO_INCREMENTAL=0
        - export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads"
        - cargo build $CARGO_OPTIONS
        - cargo test $CARGO_OPTIONS
        - |
          zip -0 ccov.zip `find . \( -name "odrive_rs*.gc*" \) -print`;
          ./grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info;
          bash <(curl -s https://codecov.io/bash) -f lcov.info;