language: node_js
node_js: '8'
#cache:
#  yarn: true
#  directories:
#    - node_modules
#      - 'interface/.meteor'

sudo: required

matrix:
  include:
    # LINUX
    - os: linux
      dist: trusty
      env:
          - GULP_PLATFORM=linux
      addons:
        artifacts:
          paths:
            - $( ls dist_{mist,wallet}/release/* | tr "\n" ":" )
        apt:
          packages:
            - icnsutils
            - graphicsmagick
            - xz-utils
            - gcc-multilib
            - g++-multilib
      before_install:
        # prepare integration tests
        - export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
        
    # MAC
    - os: osx
      osx_image: xcode8.3  
      env:
          - GULP_PLATFORM=mac
      addons:
        artifacts:
          paths:
            - $( ls dist_{mist,wallet}/release/* | tr "\n" ":" )
      before_install:
          - npm install -g yarn

install:
  - PATH=$PATH:$HOME/.meteor && curl -L https://raw.githubusercontent.com/arunoda/travis-ci-meteor-packages/1390e0f96162d0d70fc1e60a6b0f4f891a0e8f42/configure.sh | /bin/sh
  - meteor --version

  - yarn

  # only code signs when on master
  - if [[ $TRAVIS_BRANCH != "master" ]]; then unset CSC_LINK CSC_KEY_PASSWORD; fi

script:
  - yarn test:unit:once
    
  - yarn build:mist --$GULP_PLATFORM

  - yarn build:wallet --$GULP_PLATFORM
 

  - cat dist_mist/app/interface/index.html 
  - yarn test:e2e

after_success:
  - if [[ $TRAVIS_BRANCH == "master" ]]; then
      yarn dist:mist --$GULP_PLATFORM;
      yarn dist:wallet --$GULP_PLATFORM;
    fi

