language: c
sudo: false
# os:
# - osx
# - linux
# compiler:
# - gcc
# - clang
env:
#  matrix:
#  - TCLTAG=core-8-6-branch
#  - TCLTAG=core-8-6-9
#  - TCLTAG=core-8-5-branch
#  - TCLTAG=core-8-5-19
#  - TCLTAG=core-8-7-a1
#  - TCLTAG=core-8-branch
  global:
  - KITS=$HOME/kits
matrix:
  include:
    - os: linux
      dist: xenial
      compiler: clang
      env:
        - TCLTAG=core-8-6-branch
    - os: linux
      dist: xenial
      compiler: gcc-7
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - TCLTAG=core-8-6-branch
    - os: osx
      osx_image: xcode10.2
      compiler: clang
      env:
        - TCLTAG=core-8-6-branch
    - os: osx
      osx_image: xcode10.2	
      compiler: gcc-8.3
      env:
        - TCLTAG=core-8-6-branch
  allow_failures:
  - env: TCLTAG=core-8-6-branch
  - env: TCLTAG=core-8-5-branch
  - env: TCLTAG=core-8-branch
  fast_finish: true
cache:
  directories:
  - "$KITS"
before_install:
- if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
- openssl aes-256-cbc -K $encrypted_8d1065ce6623_key -iv $encrypted_8d1065ce6623_iv -in deploy_key.enc -out ./deploy_key -d
- chmod 600 ./deploy_key
- if echo "$TRAVIS_COMMIT_MESSAGE" | grep -F -q "[skip travis]" ; then echo "[skip
  travis] has been found, exiting" && exit 0 ; else echo "[skip travis] has not been
  found, continuing" ; fi
install:
- mkdir -p $KITS
- if [ $TRAVIS_OS_NAME = linux ]; then URL=http://kitcreator.rkeene.org/kits/840dec4286102c869d85bae3b0dcd32565e7bf12/tclkit;
  else URL=http://kitcreator.rkeene.org/kits/6967b89da1f6af7b12cdc82819f3bdb13a661242/tclkit;
  fi
- if [ ! -f ${KITS}/tclkit.$TRAVIS_OS_NAME ]; then wget -O ${KITS}/tclkit.$TRAVIS_OS_NAME
  $URL && chmod +x ${KITS}/tclkit.$TRAVIS_OS_NAME; fi
script:
# - python3 -c 'import os,sys; os.set_blocking(sys.stdout.fileno(), True)'
- python2 -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
- $KITS/tclkit.$TRAVIS_OS_NAME apps/build.tcl $HOME $TRAVIS_BUILD_DIR $TCLTAG

after_success:
- TARBALL="nsf_${TRAVIS_BRANCH}_${TCLTAG}_${TRAVIS_OS_NAME}_${CC}_$(date "+%Y%m%d")_${TRAVIS_BUILD_NUMBER}.tgz"
- if [ -d  $HOME/install ]; then tar -czf $TARBALL $HOME/install && scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./deploy_key $TARBALL sobernig@alice.wu.ac.at:/home/sobernig/builds; fi