# Copyright 2019 The Grin Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dist: trusty
sudo: required

language: rust

rust:
  - stable

git:
  depth: false

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - g++-5
      - cmake
      - libcurl4-openssl-dev
      - libelf-dev
      - libdw-dev
      - cmake
      - gcc
      - binutils-dev

cache:
  cargo: true
  timeout: 240
  directories:
    - $HOME/.cargo
    - $TRAVIS_BUILD_DIR/target

env:
  global:
    - RUST_BACKTRACE="1"
    - RUST_FLAGS="-C debug-assertions"

matrix:
  include:
    - os: linux
      env: CI_JOB="test"        CI_JOB_ARGS="config libwallet api"
    - os: linux
      env: CI_JOB="test"        CI_JOB_ARGS="impls"
    - os: linux
      env: CI_JOB="test"        CI_JOB_ARGS="controller ."
    - os: linux
      env: CI_JOB="release"     CI_JOB_ARGS=
    - os: osx
      env: CI_JOB="release"     CI_JOB_ARGS=
#    - os: windows
#      env: CI_JOB="release"     CI_JOB_ARGS=

script: .ci/general-jobs

before_cache:
  - rm -rf $TRAVIS_BUILD_DIR/target/tmp

before_deploy:
  - bash .ci/release-jobs

deploy:
  provider: releases
  api_key:
    secure: G2OxRSOSGAYq1mcQTYKliOiUaT8mGLp/ZFPTAjL7ByWa0OVxdlK+WEhzN7FrStdbcb1q8DNi/Mie9b2CurVjFGyqeGSCboTdYT77TDT1Wvxp9fPLG4xbgTRwAChq8o7TxOAqeC2J56HXz2Ed2529omJmn4ems6vqI9cHQ+NfpBfh6CKbPXRD7t6Ul6FygAuggYLJE5/e4ws6pRAaD0pFn3vhSab4Ka3L4LFcxffFzH2xt2fEzoA0/NjRxgD/w8wmq6om61+Jir6Zx41HH04R7zLSn7eWVxrw15o5CD4EPqhCRwYUf1kHAabaLiRcmIz9l7jtpcgzFo68A89bFROZ/GyTHazjjobLMSvo1zZnXPGyjx1MiIfOGLBo0842BuvGCEUD2ACiDoZge0+J7mzkdIVSKVx3y2sR3S7W6z4w0YZaS9pjyukhRfIYITomPUhFcJ6xTj1EsYyEAxr+Ohg5nDZgBpy9yjOmJyBKoQgdk8IMadbBO3dhCjkrw7HO4kdtwayEo/W87UH5b2thxbTsd7EWorMh+aCyzcRdRlNBUXI4pWTaP7vZPZGaBAzRYk4ETbUgxpFVxFFNlyie2TzSPz0/j/0JcG1IZxIh9eAI89ebGVKpVgFm6TQvb58J502g3dHwoGxL8lBQTc7DUQAAVBaNEnM5floFw04igQb6VQs=
  file_glob: true
  file: target/release/grin-wallet-*.*
  skip_cleanup: true
  on:
    repo: mimblewimble/grin-wallet
    tags: true