language: c
sudo: true
addons:
  apt:
    packages:
    - ksh
    - libgd2-xpm-dev
    - tcl-dev
    - libdevil-dev
    - libxaw7-dev
    - freeglut3-dev
    - colorgcc
    - libgd-dev

services:
- docker

env:
- DOCKER_BUILD=FALSE
- DOCKER_BUILD=TRUE

install:
# Enable colored gcc output
- export CC=colorgcc
# Install unit testing framework Criterion.
- cd dependencies/criterion
- mkdir build
- cd build
- cmake ..
- cmake --build .
- sudo make install
- sudo ldconfig
- cd ${TRAVIS_BUILD_DIR}
- if [ ${DOCKER_BUILD} == "TRUE" ] ; then docker build -t centos7-build-env ci/centos7/ ; fi
    
script:
- cd ${TRAVIS_BUILD_DIR}
- if [ ${DOCKER_BUILD} == "FALSE" ] ; then sudo ./ci/build_and_test.sh ; fi
- if [ ${DOCKER_BUILD} == "TRUE" ] ; then docker run --rm -v `pwd`:/graphviz -w /graphviz -i -t centos7-build-env bash "ci/build_and_test.sh" ; fi

before_deploy:
- export DEPLOYED_FILE=$(ls *.tar.gz)
- echo "deploying ${DEPLOYED_FILE} to GitHub releases"
- sudo chown travis ${DEPLOYED_FILE}

# If no tag is set, deploy as nightly
- if [ !${TRAVIS_TAG} ] ; then export TRAVIS_TAG=Nightly ; fi

deploy:
  provider: releases
  api_key:
    secure: EmdyQU0yNlq2mYtCz4xRj1Eyd73s5xYcD5tP+E42QmQhCoTSD0nb7J6H9MlzAXby2lgqDxcINvkXuEWGyySi4QHs32H7THbKs0U/dD7FuC7zFIfd2o/Q0kWyASTm8hPwu/OghmitmBXy37+QdfO4Snzy+AqVmHH3VtUax3kf0+qg12fQiNsDRXFJfO9mBddKNjxktjmfdN87pNfcVcNkCZz5DDs91ldIr6FiC+YMbfedtXqEjkavYSpFU/IX6/GJ9suJseGNH7+hmlSfw9yZT5TNd/8dnmUr2j4cD6pKgZWBQfWE/GmoJbYFbfIYfFzkwvLm3OEbr0rnsNabvKmApGpr8XBiO+w1raEXHXLsblp7eQi2BdQFu2QmVhh6vQP0uqAM12oEoC+m2FtR5WVy43RHA4tvK4hddikfUcRDRFQov9rqXj6x/cdmEhuimjugTbzmekrZ9RITucOs6YLtLry05oUjED1AD47rknTJAmZ3W93LANY7CLt8JsLhAODCZO/lTRhrXGOE2mSEiq/fqw2ZPrDPjI8J2BysYO7xb+IW1/S3seOnzL0m2Ox0wZkvDZyg9+HfjIa8AcCdJZ7EXlfDL+ExXcSbGTzwWhvy48f249cSjKM96q0SmVcIyCEapgFSIOyLSYQv3i/+5PB/ZLVT2rOdvj6zPVymAhAxEX4=
  skip_cleanup: true
  file: "${DEPLOYED_FILE}"
  on:
    repo: ellson/graphviz
    condition: ${DOCKER_BUILD} == "FALSE"

notifications:
  email:
    recipients:
      - john.ellson@comcast.net
    on_success: always
