---
sudo: required
dist: trusty
language: python
python:
  - "3.6"
addons:
  postgresql: "9.6"
git:
  depth: 3
env:
  - TEST_SUITE=tests
  - TEST_SUITE=monaco
install:
  - vagrant/install-on-travis-ci.sh
before_script:
  - psql -U postgres -c "create extension postgis"
script:
  - cd $TRAVIS_BUILD_DIR/build
  - if [[ $TEST_SUITE == "monaco" ]]; then wget --no-verbose --output-document=../data/monaco.osm.pbf http://download.geofabrik.de/europe/monaco-latest.osm.pbf; fi
  - if [[ $TEST_SUITE == "monaco" ]]; then ./utils/setup.php --osm-file ../data/monaco.osm.pbf --osm2pgsql-cache 1000 --all 2>&1 | grep -v 'ETA (seconds)'; fi
  - if [[ $TEST_SUITE == "monaco" ]]; then ./utils/specialphrases.php --wiki-import | psql -d test_api_nominatim >/dev/null; fi
  - cd $TRAVIS_BUILD_DIR/test/php
  - if [[ $TEST_SUITE == "tests" ]]; then phpunit ./ ; fi
  - if [[ $TEST_SUITE == "tests" ]]; then phpcs --report-width=120 */**.php ; fi
  - cd $TRAVIS_BUILD_DIR/test/bdd
  - # behave --format=progress3 api
  - if [[ $TEST_SUITE == "tests" ]]; then behave --format=progress3 db ; fi
  - if [[ $TEST_SUITE == "tests" ]]; then behave --format=progress3 osm2pgsql ; fi
notifications:
  email: false