# Opt into fully virtualized infrastructure
# sudo: required

language: php
dist: trusty

matrix:
  include:
    - php: 5.5
      env: DB=none;NOTESTS=1
    - php: 5.4
      env: DB=mysqli #myisam
    - php: 5.4
      env: DB=mysql
    - php: 5.4
      env: DB=mariadb
    - php: 5.4
      env: DB=postgres
    - php: 5.4
      env: DB=sqlite3
    - php: 5.5
      env: DB=mysqli
    - php: 5.6
      env: DB=mysqli
    - php: 7.0
      env: DB=mysqli
    - php: 7.1
      env: DB=mysqli
    - php: 7.2
      env: DB=mysqli
    - php: nightly
      env: DB=mysqli
  allow_failures:
    - php: nightly
  fast_finish: true

env:
  global:
    - EXTNAME="paybas/pbwowext"  # CHANGE name of the extension HERE
    - SNIFF="1"            # Should we run code sniffer on your code?
    - IMAGE_ICC="0"        # Should we run icc profile sniffer on your images?
    - EPV="1"              # Should we run EPV (Extension Pre Validator) on your code?
    - PHPBB_BRANCH="3.2.x"

branches:
  only:
    - develop32
    - /^\d+(\.\d+)?\.x$/

install:
  - travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
  - cd ../../phpBB3
  - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
  - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS
  - ../Sajaki/pbwowext/travis/prepare-epv.sh $EPV $NOTESTS

before_script:
  - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS

script:
  - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME $NOTESTS; fi"
  - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS; fi"
  - sh -c "if [ '$EPV' != '0' ] && [ '$NOTESTS' = '1' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"
  - sh -c "if [ '$NOTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php; fi"
