From 2f411db01d52ad51efac578831ec1bab02ac35ac Mon Sep 17 00:00:00 2001 From: Jeka Date: Tue, 20 Nov 2012 11:49:48 +0200 Subject: [PATCH] add configs for travis-ci --- .travis.yml | 47 +++++++++++++++++++++++ tests/travis/apache_setup.sh | 7 ++++ tests/travis/configs/apache_vhost | 29 ++++++++++++++ tests/travis/configs/config.test.php.dist | 43 +++++++++++++++++++++ tests/travis/configs/hosts | 1 + tests/travis/mysql_setup.sh | 6 +++ 6 files changed, 133 insertions(+) create mode 100644 .travis.yml create mode 100755 tests/travis/apache_setup.sh create mode 100644 tests/travis/configs/apache_vhost create mode 100644 tests/travis/configs/config.test.php.dist create mode 100644 tests/travis/configs/hosts create mode 100755 tests/travis/mysql_setup.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c96a7f21 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +language: php + +php: + - 5.3 + +before_script: + # export virtual display + - export DISPLAY=:99 + + # change application working folders for write access + - chmod -R 0777 ./tmp + - chmod -R 0777 ./uploads + - chmod -R 0777 ./templates/cache/ + - chmod -R 0777 ./templates/compiled/ + - rm -rf install/ + + # install required PHP stuff + - sudo apt-get install php5 php5-cli php5-mysql php5-mcrypt php5-xsl php5-xdebug php-apc php5-gd php5-curl php5-intl + + # launch apache, MySQL and PHPUnit Selenium installers + - ./tests/travis/apache_setup.sh + - ./tests/travis/mysql_setup.sh + - mysql -u root -e "USE social_test; SHOW TABLES;" + - cp ./tests/travis/configs/config.test.php.dist config/config.test.php + - cp ./tests/travis/configs/config.test.php.dist config/config.local.php + - sudo sed -i s/sql-mode/#sql-mode/ /etc/mysql/my.cnf + - sudo /etc/init.d/mysql restart + - sleep 5 + + # get HTML of main page (for debug) + - firefox --version + - wget -O /tmp/livestreet.test http://livestreet.test + - cat /tmp/livestreet.test + + # start virtual display + - sh -e /etc/init.d/xvfb start + - sleep 5 + + # download and launch Selenium + - wget -O /tmp/selenium-server-standalone.jar http://selenium.googlecode.com/files/selenium-server-standalone-2.25.0.jar + - java -jar /tmp/selenium-server-standalone.jar > /dev/null & + - sleep 5 + + # goto test's folder + - cd tests/behat/ + +script: HTTP_APP_ENV=test php behat.phar diff --git a/tests/travis/apache_setup.sh b/tests/travis/apache_setup.sh new file mode 100755 index 00000000..a26ce801 --- /dev/null +++ b/tests/travis/apache_setup.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +sudo apt-get install apache2 libapache2-mod-php5 curl +sudo a2enmod rewrite +echo "$(curl -fsSL https://raw.github.com/stfalcon-studio/livestreet/master/tests/travis/configs/apache_vhost)" | sed -e "s,PATH,`pwd`,g" | sudo tee -a /etc/apache2/sites-available/default > /dev/null +echo "$(curl -fsSL https://raw.github.com/stfalcon-studio/livestreet/master/tests/travis/configs/hosts)" | sudo tee -a /etc/hosts > /dev/null +sudo service apache2 restart diff --git a/tests/travis/configs/apache_vhost b/tests/travis/configs/apache_vhost new file mode 100644 index 00000000..a8fc5a07 --- /dev/null +++ b/tests/travis/configs/apache_vhost @@ -0,0 +1,29 @@ + + ServerAdmin webmaster@localhost + + DocumentRoot PATH + ServerName livestreet.test + + ErrorLog ${APACHE_LOG_DIR}/livestreet.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/livestreet.log combined + + + + ServerAdmin webmaster@localhost + + DocumentRoot PATH + ServerName livestreet.test + + ErrorLog ${APACHE_LOG_DIR}/livestreet.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/livestreet.log combined + diff --git a/tests/travis/configs/config.test.php.dist b/tests/travis/configs/config.test.php.dist new file mode 100644 index 00000000..34cb2888 --- /dev/null +++ b/tests/travis/configs/config.test.php.dist @@ -0,0 +1,43 @@ + diff --git a/tests/travis/configs/hosts b/tests/travis/configs/hosts new file mode 100644 index 00000000..1dba4f49 --- /dev/null +++ b/tests/travis/configs/hosts @@ -0,0 +1 @@ +127.0.0.1 livestreet.test diff --git a/tests/travis/mysql_setup.sh b/tests/travis/mysql_setup.sh new file mode 100755 index 00000000..d9ef38a7 --- /dev/null +++ b/tests/travis/mysql_setup.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +sudo apt-get install mysql-server mysql-client +mysql -u root -e 'CREATE DATABASE social_test;' +mysql -u root -B social_test < ./tests/fixtures/sql/install_base.sql +mysql -u root -B social_test < ./tests/fixtures/sql/geo_base.sql