diff options
Diffstat (limited to 'travis')
-rw-r--r-- | travis/phpunit-mariadb-travis.xml | 41 | ||||
-rwxr-xr-x | travis/setup-mariadb.sh | 49 | ||||
-rwxr-xr-x | travis/setup-webserver.sh | 87 |
3 files changed, 146 insertions, 31 deletions
diff --git a/travis/phpunit-mariadb-travis.xml b/travis/phpunit-mariadb-travis.xml new file mode 100644 index 0000000000..1eaee5b7d8 --- /dev/null +++ b/travis/phpunit-mariadb-travis.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit backupGlobals="true" + backupStaticAttributes="true" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + syntaxCheck="true" + strict="true" + verbose="true" + bootstrap="../tests/bootstrap.php"> + <testsuites> + <testsuite name="phpBB Test Suite"> + <directory suffix="_test.php">../tests/</directory> + <exclude>tests/functional</exclude> + <exclude>tests/lint_test.php</exclude> + </testsuite> + <testsuite name="phpBB Functional Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> + </testsuite> + </testsuites> + + <groups> + <exclude> + <group>slow</group> + </exclude> + </groups> + + <php> + <server name="PHPBB_TEST_DBMS" value="mysqli" /> + <server name="PHPBB_TEST_DBHOST" value="0.0.0.0" /> + <server name="PHPBB_TEST_DBPORT" value="3306" /> + <server name="PHPBB_TEST_DBNAME" value="phpbb_tests" /> + <server name="PHPBB_TEST_DBUSER" value="root" /> + <server name="PHPBB_TEST_DBPASSWD" value="" /> + <server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/> + <server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" /> + </php> +</phpunit> diff --git a/travis/setup-mariadb.sh b/travis/setup-mariadb.sh new file mode 100755 index 0000000000..aceb6af7ee --- /dev/null +++ b/travis/setup-mariadb.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# @copyright (c) 2013 phpBB Group +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# +set -e +set -x + +# MariaDB Series +VERSION='5.5' + +# Operating system codename, e.g. "precise" +OS_CODENAME=$(lsb_release --codename --short) + +# Manually purge MySQL to remove conflicting files (e.g. /etc/mysql/my.cnf) +sudo apt-get purge -y mysql-common + +if ! which add-apt-repository > /dev/null +then + sudo apt-get update + sudo apt-get install -y python-software-properties +fi + +MIRROR_DOMAIN='ftp.osuosl.org' +sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db +sudo add-apt-repository "deb http://$MIRROR_DOMAIN/pub/mariadb/repo/$VERSION/ubuntu $OS_CODENAME main" +sudo apt-get update + +# Pin repository in order to avoid conflicts with MySQL from distribution +# repository. See https://mariadb.com/kb/en/installing-mariadb-deb-files +# section "Version Mismatch Between MariaDB and Ubuntu/Debian Repositories" +echo " +Package: * +Pin: origin $MIRROR_DOMAIN +Pin-Priority: 1000 +" | sudo tee /etc/apt/preferences.d/mariadb + +sudo debconf-set-selections <<< "mariadb-server-$VERSION mysql-server/root_password password rootpasswd" +sudo debconf-set-selections <<< "mariadb-server-$VERSION mysql-server/root_password_again password rootpasswd" +sudo apt-get install -y mariadb-server + +# Set root password to empty string. +echo " +USE mysql; +UPDATE user SET Password = PASSWORD('') where User = 'root'; +FLUSH PRIVILEGES; +" | mysql -u root -prootpasswd + +mysql --version diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 95fc4ec1f8..6188d2c232 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -1,54 +1,79 @@ #!/bin/bash # -# @copyright (c) 2013 phpBB Group +# @copyright (c) 2014 phpBB Group # @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # set -e +set -x -sudo apt-get update -qq -sudo apt-get install -qq nginx realpath +if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] +then + # Add PPA providing dependencies for recent HHVM on Ubuntu 12.04. + sudo add-apt-repository -y ppa:mapnik/boost +fi + +sudo apt-get update +sudo apt-get install -y nginx realpath sudo service nginx stop DIR=$(dirname "$0") +USER=$(whoami) PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB") - NGINX_CONF="/etc/nginx/sites-enabled/default" +APP_SOCK=$(realpath "$DIR")/php-app.sock -PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" -PHP_FPM_CONF="$DIR/php-fpm.conf" -PHP_FPM_SOCK=$(realpath "$DIR")/php-fpm.sock +if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] +then + # Upgrade to a recent stable version of HHVM + sudo apt-get -o Dpkg::Options::="--force-confnew" install -y hhvm-nightly -USER=$(whoami) + # MySQLi is broken in HHVM 3.0.0~precise and still does not work for us in + # 2014.03.28~saucy, i.e. needs more work. Use MySQL extension for now. + sed -i "s/mysqli/mysql/" "$DIR/phpunit-mysql-travis.xml" -# php-fpm configuration -echo " -[global] + HHVM_LOG=$(realpath "$DIR")/hhvm.log -[travis] -user = $USER -group = $USER -listen = $PHP_FPM_SOCK -pm = static -pm.max_children = 2 + sudo hhvm \ + --mode daemon \ + --user "$USER" \ + -vServer.Type=fastcgi \ + -vServer.FileSocket="$APP_SOCK" \ + -vLog.File="$HHVM_LOG" +else + # php-fpm + PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" + PHP_FPM_CONF="$DIR/php-fpm.conf" -php_admin_value[memory_limit] = 128M -" > $PHP_FPM_CONF + echo " + [global] -# nginx configuration + [travis] + user = $USER + group = $USER + listen = $APP_SOCK + pm = static + pm.max_children = 2 + + php_admin_value[memory_limit] = 128M + " > $PHP_FPM_CONF + + sudo $PHP_FPM_BIN \ + --fpm-config "$DIR/php-fpm.conf" +fi + +# nginx echo " -server { - listen 80; - root $PHPBB_ROOT_PATH/; - index index.php index.html; - - location ~ \.php { - fastcgi_pass unix:$PHP_FPM_SOCK; - include fastcgi_params; + server { + listen 80; + root $PHPBB_ROOT_PATH/; + index index.php index.html; + + location ~ \.php { + fastcgi_pass unix:$APP_SOCK; + include fastcgi_params; + } } -} " | sudo tee $NGINX_CONF > /dev/null -# Start daemons -sudo $PHP_FPM_BIN --fpm-config "$DIR/php-fpm.conf" sudo service nginx start |