language: rust
sudo: false
dist: trusty # still in beta, but required for the prebuilt TF binaries

cache:
  cargo: true

rust:
  - stable
  - beta
  - nightly

env:
  global:
    - RUST_BACKTRACE=1
    # - CC="gcc-4.9"
    # - CXX="g++-4.9"
  matrix:
    # Building TensorFlow in Travis is not working properly, probably due
    # to resources constraints.
    # - TF_RUST_BUILD_FROM_SRC=true
    - TF_RUST_BUILD_FROM_SRC=false

os:
  - linux
  - osx

matrix:
  fast_finish: true
  allow_failures:
    - rust: nightly


install:
  # Install dependencies only if we build tensorflow from source.
  - if [[ "$TF_RUST_BUILD_FROM_SRC" == "true" ]]; then source travis-ci/install.sh; fi
  - if [[ "$TF_RUST_BUILD_FROM_SRC" == "true" ]]; then pip install --user numpy; fi

script:
  - ./test-all

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test

    packages:
      # Re-enable if we ever re-enable building from source on Travis. Only needed for building TensorFlow itself, not the Rust bindings.
      # - g++-4.9
      # - gcc-4.9
      - oracle-java8-installer
      - swig

notifications:
  email: false
