language: php

php:
# Here is where we can list the versions of PHP you want to test against
# using major version aliases
  - 5.4
  - 5.5
  - 5.6
  - nightly

# optionally specify a list of environments, for example to test different RDBMS
env:
  - DB=mysql
  - DB=pgsql

install:
  - mkdir -p data
  - php -S 127.0.0.1:8080 tests/router.php >>data/php.log 2>>data/php.log & sleep 3

  # Enable logging of all queries (for debugging) and create the database schema for shimmie.
  - if [[ "$DB" == "pgsql" ]]; then psql -c "SELECT set_config('log_statement', 'all', false);" -U postgres; fi
  - if [[ "$DB" == "pgsql" ]]; then psql -c "CREATE DATABASE shimmie;" -U postgres; fi
  - if [[ "$DB" == "mysql" ]]; then mysql -e "SET GLOBAL general_log = 'ON';" -uroot; fi
  - if [[ "$DB" == "mysql" ]]; then mysql -e "CREATE DATABASE shimmie;" -uroot; fi

script:
  - php tests/install.php -d $DB -h "http://127.0.0.1:8080/"
  - php tests/all.php -h "http://127.0.0.1:8080/"

# If a failure occured then dump out a bunch of logs for debugging purposes.
after_failure:
  - sudo ls -al
  - sudo ls -al data/config/
  - sudo cat data/config/shimmie.conf.php
  - sudo cat data/config/extensions.conf.php
  - sudo cat data/php.log
  - sudo ls /var/run/mysql*
  - sudo ls /var/log/*mysql*
  - sudo cat /var/log/mysql.err
  - sudo cat /var/log/mysql.log
  - sudo cat /var/log/mysql/error.log
  - sudo cat /var/log/mysql/slow.log
  - sudo ls /var/log/postgresql
  - sudo cat /var/log/postgresql/postgresql*

# configure notifications (email, IRC, campfire etc)
#notifications:
#  irc: "irc.freenode.org#shimmie"
#