Merge pull request #2375 from nickvergessen/ticket/12470

Ticket/12470 Move commands from .travis.yml to separate files to allow reusing

* nickvergessen/ticket/12470:
  [ticket/12470] Correctly set up the php extensions
  [ticket/12470] Fix setup of phpbb
  [ticket/12470] Move setup of phpBB to new .sh
  [ticket/12470] Move setup of database to new .sh
  [ticket/12470] Move phing sniff into new .sh
This commit is contained in:
Andreas Fischer 2014-05-03 15:53:57 +02:00
commit 4e529fda03
4 changed files with 75 additions and 13 deletions

View file

@ -14,23 +14,13 @@ services:
- redis-server
install:
- sh -c "if [ '$DB' = 'mariadb' ]; then travis/setup-mariadb.sh; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then travis/setup-php-extensions.sh; fi"
- sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi"
- cd phpBB
- php ../composer.phar install --dev --no-interaction --prefer-source
- cd ..
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
before_script:
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3' -a '$DB' = 'mysql' ]; then mysql -e 'SET GLOBAL storage_engine=MyISAM;'; fi"
- sh -c "if [ '$DB' = 'mysql' -o '$DB' = 'mariadb' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi"
- travis/setup-database.sh $DB $TRAVIS_PHP_VERSION
script:
- cd build
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then ../phpBB/vendor/bin/phing sniff; fi"
- cd ..
- travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION
- phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"

17
travis/phing-sniff.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
set -x
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysql" ]
then
cd build
../phpBB/vendor/bin/phing sniff
cd ..
fi

26
travis/setup-database.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
set -x
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$DB" == "postgres" ]
then
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
psql -c 'create database phpbb_tests;' -U postgres
fi
if [ "$TRAVIS_PHP_VERSION" == "5.3" -a "$DB" == "mysql" ]
then
mysql -e 'SET GLOBAL storage_engine=MyISAM;'
fi
if [ "$DB" == "mysql" -o "$DB" == "mariadb" ]
then
mysql -e 'create database IF NOT EXISTS phpbb_tests;'
fi

29
travis/setup-phpbb.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
#
# @copyright (c) 2014 phpBB Group
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
set -x
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$DB" == "mariadb" ]
then
travis/setup-mariadb.sh
fi
if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]
then
travis/setup-php-extensions.sh
fi
if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` == "1" ]
then
travis/setup-webserver.sh
fi
cd phpBB
php ../composer.phar install --dev --no-interaction --prefer-source
cd ..