language: generic
cache:
  directories:
    - $HOME/.cargo
    - $TRAVIS_BUILD_DIR/target
    - $HOME/docker/
    
before_install:
  - if [[ "$NAME" == "linux32" ]]; then
    sudo dpkg --purge build-essential libtool;
    sudo apt-get -qq update;
    sudo apt-get -yq --force-yes install libstdc++6:i386 libbz2-dev:i386 gcc-multilib:i386 musl-tools:i386; fi
    
matrix:
  include:
    - os: linux
      env:
        - TARGET=armv7-unknown-linux-gnueabihf
        - NAME=arm7hf
        - EXT=tar.gz
      addons:
        apt:
          packages: &armhf
          - gcc-arm-linux-gnueabihf
          - libc6-armhf-cross
          - libc6-dev-armhf-cross
    - os: linux
      env:
        - TARGET=x86_64-unknown-linux-musl
        - NAME=linux64
        - EXT=tar.gz
      dist: trusty
      sudo: required
      addons:
        apt:
          packages:
          - musl-tools
          - libbz2-dev
    - os: linux
      env:
        - TARGET=i686-unknown-linux-musl
        - NAME=linux32
        - EXT=tar.gz
      dist: trusty
      sudo: required
    - os: linux
      env:
        - TARGET=x86_64-pc-windows-gnu
        - NAME=win64
        - EXT=zip
      dist: trusty
      sudo: required
      addons:
        apt:
          packages:
          - gcc-mingw-w64-x86-64
          - binutils-mingw-w64-x86-64
          - libbz2-dev
    - os: linux
      env:
        - TARGET=i686-pc-windows-gnu
        - NAME=win32
        - EXT=zip
        - TOOLCHAIN=nightly
        - DOCKER_IMAGE=i686-trusty
      dist: trusty
      services:
        - docker
    - os: osx
      env:
        - TARGET=x86_64-apple-darwin
        - NAME=macos
        - EXT=tar.gz

script:
  - bash ci.sh

deploy:
  provider: releases
  api_key:
    secure:
      OY6y0xRhlGSBH+3+7+7K6s4pp0Tf3BA61NAubEK4gpO23AKfyJUK+vqqCbdo06Z0E4QO4O1ke6fot7Gq9EdxJmsl/Kk5LDd9Rv3BXSYdjPupzs7coYuD8wv10NfAX6ETd9ITyPim2Zq6bq8nx1S2ESTpos/js1HCtVW3nrlCV58=
  skip_cleanup: true
  file:
    - "geckodriver-$TRAVIS_TAG-$NAME.$EXT"
  on:
    tags: true
    repo: mozilla/geckodriver
    condition: -n "$NAME"
