# Travis-CI Build for RfidResearchGroup/Proxmark3
language: c

#default linux build env is: xenial
compiler: gcc

# move some env variables to homebrew env
env:
  global:
    - HOMEBREW_TRAVIS_BRANCH=$TRAVIS_BRANCH
    - HOMEBREW_TRAVIS_COMMIT=$TRAVIS_COMMIT

# Test on Linux and MacOS
matrix:
  include:
    - os: osx
      osx_image: xcode11
      env: MAKE_PARAMS='PLATFORM_EXTRAS='
    - os: osx
      osx_image: xcode11
      env: MAKE_PARAMS='PLATFORM_EXTRAS=BTADDON'
    - os: linux
      dist: xenial
      sudo: required
      env: MAKE_PARAMS='PLATFORM_EXTRAS='
    - os: linux
      dist: xenial
      sudo: required
      env: MAKE_PARAMS='PLATFORM_EXTRAS=BTADDON'

addons:
  apt:
    packages:
      - gcc-arm-none-eabi
      - libnewlib-dev
      - libsndfile1-dev
  homebrew:
    packages:
      - readline
      - libsndfile
      - qt5
      - RfidResearchGroup/proxmark3/arm-none-eabi-gcc
    taps: RfidResearchGroup/proxmark3

install:
  if ! arm-none-eabi-gcc -v; then 
    echo "arm-none-eabi-gcc [ERROR]";
    travis_terminate 1;
  fi
    
  make clean;
  make all V=1 "$MAKE_PARAMS";

script:
## start and run a test script
  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
    ./pm3test.sh;  
  elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
    ./pm3test.sh;
  fi
