dist: trusty
language: rust
services: docker
sudo: required

env:
  global:
    - CRATE_NAME={{PKG_NAME}}
    - RUST_BACKTRACE=1

matrix:
  include:
    - env: TARGET=armv7-unknown-linux-gnueabihf
      rust: nightly
    - env: TARGET=x86_64-unknown-linux-musl
      rust: nightly
    - env: TARGET=x86_64-apple-darwin
      rust: nightly
      os: osx
    - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
      rust: nightly

before_install:
  - set -e

install:
  - sh scripts/install.sh
  - source ~/.cargo/env || true

script:
  - bash scripts/script.sh

after_script: set +e

before_deploy:
  - sh scripts/before_deploy.sh

deploy:
  provider: releases
  skip_cleanup: true
  file_glob: true
  file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
  api_key:
    secure: "{{TOKEN}}"
  on:
    tags: true

cache: cargo
before_cache:
  - chmod -R a+r $HOME/.cargo

notifications:
  email:
    on_success: never
    on_failure: never
