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

dist: trusty
language: rust
services: docker

env:
  global:
    - CRATE_NAME=so

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

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

    # TODO figure out how to get tls libraries working on *bsd targets
    # BSD
    # - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 PKG_CONFIG_ALLOW_CROSS=1

before_install:
  - set -e
  - rustup self update

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

script:
  - bash ci/script.sh

after_script: set +e

before_deploy:
  - sh ci/before_deploy.sh

deploy:
  token:
    secure: 1wWcYP/bJ3Poba8Y4D1BFV//8JFSJOL74ah9JP+QbOH7HmXtIX2xjaVUhzhZNU0rQHzibPzlbbe1lyr/SKqbCwzupowxxFlx6MOovQd8su8BWKsONpIaFtIMRDvkRVTIKo1/9Wp7tdjoFBVohY0ERnMuj2oV51tavYyl+hdEViZb6qQyGGuzotK1LzOaQslAqtCIjbs2mVXGkSURDuikYVJld8wyaO02zIeALDEs+czbQI0AUQ1l+dsy2vk+/pds2w5cgLGe7jtbFWLTgZU5eChV/3ArWSgeDxlZiNCDdUXfJ35TSLtrLzEexqVZNz3njlSfdOc5kueYGG1PhetNUJ+8WWDtoes3GnSYyh/lNv4UOjH34OZBrfazWllGHdDEE9yl/0Hu/QJ8uDUtDyImtfRCmJNRNZO7VkBturl/D8z6/Mq3mMF/fWkWfHlA4bDRtIA20ZYCzilmAT4DuMl8QQ89M6B65uJkBHN1EbnXMQTB/tzuvDRFbaRzCZ1WMudGoT9PyhgRcTzJEhGzfoEMRlUIbAffihnkiPyT7VRYcL2zSefnw2pvrnuZmykrkHF8/oyUPHvgYp1s/GMhBZexfrJ2moOWoxObYscoeI0gphLdycwHv5tJXR4U7eIoTD4SUYjNfwJf84G7rFbM62WfXUxO+gvJzQsHr3XxSZVoZ1c=
  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
    - develop

notifications:
  email:
    on_success: never
