language: python
dist: xenial

env:
  - TEST="flake8"
  - OS=debian10 PY=3 TEST="testsuit"
  - OS=debian10 PY=2 TEST="testsuit"
  - OS=debian9 PY=3 TEST="testsuit"
  - OS=debian9 PY=2 TEST="testsuit"
  - OS=ubuntu20.04 PY=3 TEST="testsuit"
  - OS=ubuntu18.04 PY=3 TEST="testsuit"
  - OS=ubuntu18.04 PY=2 TEST="testsuit"
  # - OS=ubuntu16.04 PY=2 TEST="testsuit"
  # - OS=ubuntu16.04 PY=3 TEST="testsuit"
  # - OS=debian8 PY=3 TEST="testsuit"
  # - OS=debian8 PY=2 TEST="testsuit"

services:
  - docker

before_install:
  - if [ $TEST == "flake8" ]; then sudo apt-get update -qq ; fi
  - if [ $TEST == "flake8" ]; then sudo pip install flake8; fi
  - if [ $TEST == "testsuit" ]; then chmod +x .travis/run.sh; fi
  - if [ $TEST == "testsuit" ]; then chmod +x .travis/install.sh; fi

before_script:
  - if [ $TEST == "testsuit" ]; then docker build -t ndts .travis/${OS}_py${PY}; fi
  - if [ $TEST == "testsuit" ]; then docker run  --name  ndts -d -it -v `pwd`:/home/tango  ndts; fi
  - if [ $TEST == "testsuit" ]; then .travis/install.sh ${OS} ${PY}; fi

script:
  - if [ $TEST == "testsuit" ]; then .travis/run.sh ${PY}; fi
  - if [ $TEST == "flake8" ]; then flake8; fi


after-script:
  - if [ $TEST == "testsuit" ]; then docker stop ndts; fi
  - if [ $TEST == "testsuit" ]; then docker rm ndts; fi
