# Long tests: run on commits to master branch/cron builds

language: c
sudo: required
dist: trusty
matrix:
  include:
    # Ubuntu 14.04
    - env: Cmd='make gcc6install && CC=gcc-6 make clean uasan-test'
    - env: Cmd='make gcc6install libc6install && CC=gcc-6 make clean uasan-test32'
    - env: Cmd='make clang38install && CC=clang-3.8 make clean msan-test'
    - env: Cmd='make clang38install && CC=clang-3.8 make clean tsan-test-zstream'
    - env: Cmd='make valgrindinstall && make -C tests clean valgrindTest'

    - env: Cmd='make arminstall && make armtest'
    - env: Cmd='make arminstall && make aarch64test'
    - env: Cmd='make ppcinstall && make ppctest'
    - env: Cmd='make ppcinstall && make ppc64test'


    - env: Cmd='make gpp6install valgrindinstall && make -C zlibWrapper test && make -C zlibWrapper valgrindTest'
    - env: Cmd='make -C tests versionsTest'
    - env: Cmd='make gpp6install && cd contrib/pzstd && make test-pzstd && make test-pzstd32 && make test-pzstd-tsan && make test-pzstd-asan'
      install:
        - export CXX="g++-6" CC="gcc-6"
    - env: Cmd='make gcc6install && CC=gcc-6 make uasan-test-zstd-nolegacy'
    - env: Cmd='make gcc6install && CC=gcc-6 make uasan-test-zbuff'

    # OS X Mavericks
    - env: Cmd="make gnu90build && make clean && make test && make clean && make cmakebuild && make travis-install"
      os: osx

before_install:
  - if [ `uname` = "Darwin" ]; then brew update; fi

install:
  - if [ `uname` = "Darwin" ]; then brew install xz; fi

git:
  depth: 1

branches:
  only:
  - dev
  - master

script:
  - JOB_NUMBER=$(echo $TRAVIS_JOB_NUMBER | sed -e 's:[0-9][0-9]*\.\(.*\):\1:')
  - echo JOB_NUMBER=$JOB_NUMBER TRAVIS_BRANCH=$TRAVIS_BRANCH TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
  - export FUZZERTEST=-T5mn;
    export ZSTREAM_TESTTIME=-T5mn;
    export DECODECORPUS_TESTTIME=-T1mn;
    if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
        git fetch origin dev;
        git checkout -f FETCH_HEAD;
    fi;
    sh -c "$Cmd" || travis_terminate 1;
