language: rust
rust: nightly
sudo: false

before_script:
  - cargo install clippy || true
  - export PATH=$HOME/.cargo/bin:$PATH

script:
  - |
    if [ -n "$TRAVIS_COMMIT_RANGE" ]; then
      printf 'Checking for tabs in %s\n' "$TRAVIS_COMMIT_RANGE"
      ! git diff --name-only --diff-filter=ACMR "$TRAVIS_COMMIT_RANGE" | xargs grep $'\t'
    fi
  - cargo test --all --all-features
  - |
    if command -v cargo-clippy > /dev/null; then
      CLIPPY_STATUS=0
      for package in maud_htmlescape maud_macros maud maud_extras; do
        cargo clippy --manifest-path $package/Cargo.toml -- -D warnings || CLIPPY_STATUS=$?
      done
      (exit $CLIPPY_STATUS)
    fi