# Based on the "trust" template v0.1.2
# https://github.com/japaric/trust/tree/v0.1.2

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

env:
  global:
    - CRATE_NAME=silicon

addons:
  apt:
    packages:
      - libx11-xcb-dev
      - libxcb-shape0-dev
      - libxcb-xfixes0-dev

matrix:
  include:
    # Linux
    - env: TARGET=x86_64-unknown-linux-gnu

    # OSX
    - env: TARGET=x86_64-apple-darwin
      os: osx

    # Testing other channels
    - env: TARGET=x86_64-unknown-linux-gnu
      rust: nightly

    - env: TARGET=x86_64-unknown-linux-gnu
      rust: beta

before_install:
  - set -e
  - rustup self update

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

script:
  - bash ci/script.sh

after_script: set +e

before_deploy:
  - bash ci/before_deploy.sh

deploy:
  api_key:
    secure: bwUsR03KCY3xswAbZzKaUEvR2G3kOm9lhZA0uHZdm3bx6vLSsq0zuwBoS3Cp60ACyZHYNej3Kt4SajZYloLbfoKJppV26qfE2Dd6f5EtHRnIEi3WY8d74ZUDUAjy4uGoC6N8nRiKrxuJhyUvGXz2kqDbCcwGXxuCEvodfJ7TaqOVOzEhpGC9G5zRokhyzzbgwXxFomD6ewGfQF7D95OgoiRFw1wGADlUM3h4WwQW8VYPDAtXbdQ2k7qZ2EyZEPz4oXfLqQ1saYfwWHztqzfZBvSs9gFNfQfZ8CquLKPV6vtS0BXvzGXbDTYr2Pj752owkvGZ1eEYFVz2kq9dJbIUYk0m/Me3qwNu8YfGPFW+g98X4eByyLkwWYJhKn83SPckgKwIve3j6ivSYNujg8cUc4DLEEK/dbo1FQ5qmmRLwzBjCxT3pQ9qZArA5+K+7dPfTBpC3VLrrW07fRNwoYvT4cxgtDTz15q8d7Vz65fo1mS1/RnHAGmSVXVa/CdPE43gsSjwuLWpzHoDl3jBVo37QyvPbBL2EeHUf456yzSaOLHaVn9K8E4DbtCltUaXU8eekzKzPpKb/eJQnt0k9WjAtHvXbsJjP1yTKzTFFJ6mHPxQHKyRB6Tugmou0OVcsT7RRTahaWTl2hmitY9yQHqEwYBQ+RlcdBHcokXhu6Y2gv4=
  file_glob: true
  file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
  on:
    condition: $TRAVIS_RUST_VERSION = stable
    tags: true
  provider: releases
  skip_cleanup: true

cache: cargo
before_cache:
  # Travis can't cache files that are not readable by "others"
  - chmod -R a+r $HOME/.cargo

branches:
  only:
    # release tags
    - /^v\d+\.\d+\.\d+.*$/
    - master
    # This is where pull requests from "bors r+" are built.
    - staging
    # This is where pull requests from "bors try" are built.
    - trying

notifications:
  email:
    on_success: never
