sudo: required
dist: trusty
language: cpp
script: cmake

matrix:
    include:
        # OSX
        - os: osx
          compiler: clang

        - os: linux
          compiler: gcc
          addons: &gcc
            apt:
              packages:
                - util-linux
                - g++-5
                - cppcheck
                - clang-4.0
                - clang-tidy-4.0
                - realpath
                - python3-pip
              sources:
                - ubuntu-toolchain-r-test
                - llvm-toolchain-trusty-4.0

install:
    - export CHECKOUT_PATH=`pwd`
    # Show compiler info
    - $CXX --version
    - which $CXX
    - $CC --version
    - which $CC
    - which cmake
    - cmake --version
    - python3 --version
    - pip3 install --user 'cmakelang[YAML]'
    
script:
    - export INSTALL_PREFIX_PATH="${TRAVIS_BUILD_DIR}/usr"
    - export PATH="/Users/travis/Library/Python/3.7/bin:$PATH"
    - mkdir -p "$INSTALL_PREFIX_PATH"
    - cd $CHECKOUT_PATH
    - cmake-lint $(find ./test -type f | grep .cmake$) $(find ./share -type f | grep .cmake$)
    - mkdir build
    - cd build
    - cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX_PATH ..
    - make check
    - make install
    - rm -rf "$INSTALL_PREFIX_PATH"

