language: cpp
cache: ccache
sudo: required
dist: xenial

os:
  - linux

addons:
  apt:
    packages:
#      - git
#      - python
#      - python-pip
#      - python2.7-dev
#      - libc6-i386
#      - curl
      - clang-format-3.8
        
before_install:
  - sudo pip install cpplint pre-commit==1.10.3
  - sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format
  # Download and install recent cmake

script:
  - | 
    function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
  - |
    timeout 600 .travis/pre-commit-job.sh # 10min timeout
    RESULT=$?; if [ $RESULT -eq 0 ] || [ $RESULT -eq 142 ]; then true; else exit 1; fi;

notifications:
  email:
    on_success: change
    on_failure: always