sudo: false

language: rust

os:
- linux
- osx

osx_image: xcode7.1

rust:
- nightly
- beta
- stable

addons:
  apt:
    packages:
    - libcurl4-openssl-dev
    - libelf-dev
    - libdw-dev
    - binutils-dev

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python; fi

before_script:
- pip install -v 'travis-cargo<0.2' --user
- if [[ -e ~/Library/Python/2.7/bin ]]; then export PATH=~/Library/Python/2.7/bin:$PATH; fi
- if [[ -e ~/.local/bin ]]; then export PATH=~/.local/bin:$PATH; fi
- echo PATH is $PATH

script:
- |
  travis-cargo build &&
  travis-cargo test &&
  travis-cargo bench &&
  ([[ $TRAVIS_OS_NAME == "osx" ]] && (
      with_debug_info=$(find ./target/debug -type f | grep DWARF | grep gimli | head -n 1) &&
      travis-cargo run -- --example dwarfdump "$with_debug_info" > /dev/null
  ) || (
      travis-cargo run -- --example dwarfdump ./target/debug/gimli-* > /dev/null
  )) &&
  travis-cargo --only stable doc

after_success:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis-cargo --only stable doc-upload; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis-cargo coveralls --no-sudo --verify; fi

env:
  global:
  - TRAVIS_CARGO_NIGHTLY_FEATURE=nightly
  - secure: sZn3hj3DSEymINts4V3qhJ3bO3Epl2TkK/UDGwM5qPU87fnJsLMo4pH1YoJJv42EGMo7UU5G8EkARto5Kjpqdncg8TXZj4VNq3mdEBW219FhgwA6bjuLl+QYj1F0gFVb7SccbjlgH8B6yrWKXfL7HBZJ3c6ymZQSKly66Kv6lWPN8ePW7QTMqK+WUZtgIhR0kBiQSngdfdmyYaAnqCNYoiATE2jSZ7roDmf7GcTiohH+Yt6a39njgqIP6qofVnAWXg37cokrU0pAix0HK2bgfgoSOFd9yYWqPkf3Rr2edJdEXTwOQKkOmPJevrsTowbzrS+VXwuSkGBAtMGw4+CFLT0X1As9+IrGa3jonBotzEkpglOnCiJHRLdPlOrsXuUGD9TGEPrRBqhxwgiMNi6E/G+NX3O9+evZssx93qVhgFAZ1FRzSKJezaOrpRQNF/r5QCcZlQo6ZoCR/Lgd/mHdsnCVyQlN1Ye4rWchws+73zei2Wmdy3gOj8c7O9R7G5wc9PBletAmFfkavS4TKqnbRn5s5AHpaWbnX1kfVfUpnyPTmopMxhwWtQeWuO+s2Q5pSfcXoQK9uBXP4+qfHcF18M6iDimlmZK8NNDqwix0prc7HEHipsSoxN0yoS6AoZmwC5rJ4e4E8FNF0EIHM9T9w0rTzR+Z7txUBg90jXGjkW8=
