# ------------------------------------------------------------------------------
# Travis CI scripts 
# Copyright(c) pgRouting Contributors
#
# Main configuration
# ------------------------------------------------------------------------------

#choose precise or trusty

#group: edge
#dist: trusty    

#dist: precise


language: cpp

compiler:
    - gcc


env: POSTGRESQL_VERSION=9.6   PG_USER=postgres
      
matrix:
  include:
    - os: linux
      sudo: required
      dist: precise
      env: POSTGRESQL_VERSION=9.5   PG_USER=postgres


    - os: linux
      sudo: required
      dist: precise
      env: POSTGRESQL_VERSION=9.4   PG_USER=postgres


    - os: linux
      sudo: required
      dist: trusty
      group: edge
      env: POSTGRESQL_VERSION=9.6   PG_USER=postgres


    - os: linux
      sudo: required
      dist: trusty
      group: edge
      env: POSTGRESQL_VERSION=9.5   PG_USER=postgres




# executed. So things have to be tested oe by one.
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
      # For cmake
      - kubuntu-backports
      - boost-latest
    packages:
      - cmake
      - libboost-thread-dev
      - libboost-graph-dev
      - libcgal-dev
      - python-sphinx





install:
  - sudo ./tools/travis/install-postgres.sh $POSTGRESQL_VERSION $PG_USER
  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ./tools/travis/install-doxygen.sh ; fi

before_script:

  # Add our chosen PG version to the path
  - export PATH=/usr/lib/postgresql/$POSTGRESQL_VERSION/bin:$PATH

  # initialize databases
  - createdb  -U $PG_USER ___pgr___test___
  - createdb  -U $PG_USER pgr_test__db__test
  - ./tools/travis/check-extensions.sh $POSTGRESQL_VERSION ___pgr___test___


script: 
  - ./tools/travis/pgrouting_build.sh $POSTGRESQL_VERSION $POSTGIS_VERSION
  # tests as part of script so if a test fails the build fails
  - ./tools/travis/pgrouting_test.sh $POSTGRESQL_VERSION $PG_USER
  - ./tools/testers/pg_prove_tests.sh $PG_USER DEBUG

after_script: 
  # blank

#after_success:
  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ./tools/travis/test-documentation.sh ; fi
