Push the test environment setup into a separate shell script.
This commit is contained in:
parent
173e8ef164
commit
09fe543a4b
2 changed files with 50 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
language: php
|
||||
# list any PHP version you want to test against
|
||||
# list the versions of PHP you want to test against
|
||||
php:
|
||||
# using major version aliases
|
||||
- 5.3
|
||||
|
@ -13,11 +13,7 @@ before_install:
|
|||
- sudo apt-get update > /dev/null
|
||||
|
||||
install:
|
||||
- sudo apt-get install -y nginx --fix-missing
|
||||
- sudo apt-get install -y php5-fpm php5-mysql --fix-missing
|
||||
- sudo cp tests/travis_nginx.conf /etc/nginx/nginx.conf
|
||||
- sudo /etc/init.d/nginx restart
|
||||
- sudo /etc/init.d/php5-fpm restart
|
||||
- sudo ./test/setup_test_enviroment.sh $TRAVIS_BUILD_DIR
|
||||
|
||||
# execute any number of scripts before the test run, custom env's are available as variables
|
||||
before_script:
|
||||
|
|
48
tests/setup_test_enviroment.sh
Normal file
48
tests/setup_test_enviroment.sh
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Set up the Travis-CI test enviroment for Shimmie.
|
||||
# (this script should be run as root via sudo)
|
||||
#
|
||||
# @copyright (c) 2014 jgen
|
||||
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
#
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# Install the necessary packages
|
||||
sudo apt-get install -y nginx realpath php5-fpm php-mysql --fix-missing
|
||||
|
||||
# Stop the daemons
|
||||
sudo service nginx stop
|
||||
sudo /etc/init.d/php5-fpm stop
|
||||
|
||||
SHIMMIE_ROOT=$(realpath "$0")
|
||||
|
||||
NGINX_CONF="/etc/nginx/sites-enabled/default"
|
||||
|
||||
# nginx configuration
|
||||
echo "
|
||||
server {
|
||||
listen 80 default;
|
||||
|
||||
root $SHIMMIE_ROOT/;
|
||||
|
||||
index index.php
|
||||
|
||||
location ~ /_?(images|thumbs)/ {
|
||||
default_type image/jpeg;
|
||||
}
|
||||
|
||||
location ~ \.php($|/) {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
" | sudo tee $NGINX_CONF > /dev/null
|
||||
|
||||
# Start daemons
|
||||
sudo /etc/init.d/php5-fpm start
|
||||
sudo service nginx start
|
Reference in a new issue