Skip to content

Commit

Permalink
[TASK] travis: Acceptance tests with nginx+fpm
Browse files Browse the repository at this point in the history
* Start a php-fpm server on port 9000
* Install nginx, configure and start on port 8000 for acceptance tests
* Use phantomjs provided by composer directly without selenium

Change-Id: Ie25c27d765437ed0a12d1df9b0c9b1a4355b1024
Resolves: #75837
Releases: master
Reviewed-on: https://review.typo3.org/47815
Reviewed-by: Christian Kuhn <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
  • Loading branch information
lolli42 committed Apr 21, 2016
1 parent 319b0aa commit 43fc083
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 26 deletions.
40 changes: 15 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ matrix:

include:
- php: 7
env: UNIT_TESTS=yes FUNCTIONAL_TESTS=yes ACCEPTANCE_TESTS=no PHP_LINT=yes XLF_CHECK=yes SUBMODULE_TEST=yes EXCEPTIONCODE_TEST=yes
env: UNIT_TESTS=yes FUNCTIONAL_TESTS=yes ACCEPTANCE_TESTS=yes PHP_LINT=yes XLF_CHECK=yes SUBMODULE_TEST=yes EXCEPTIONCODE_TEST=yes

sudo: false

Expand All @@ -14,6 +14,8 @@ addons:
packages:
- parallel
- ack-grep
- nginx
- realpath

cache:
directories:
Expand Down Expand Up @@ -50,51 +52,41 @@ before_script:
- phpenv config-rm xdebug.ini
- if [ "$GITHUB_COMPOSER_AUTH" ]; then composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH; fi
- composer install
- typo3/sysext/core/Build/Configuration/TravisNginxFpm/ConfigureStartNginxFpm.sh
- mkdir -p typo3temp/var/tests
- export typo3DatabaseName="typo3"
- export typo3DatabaseHost="localhost"
- export typo3DatabaseUsername="root"
- export typo3DatabasePassword=""

script:
- >
if [[ "$UNIT_TESTS" == "yes" ]]; then
echo;
echo "Running unit tests";
./bin/phpunit -c typo3/sysext/core/Build/UnitTests.xml
fi
- >
if [[ "$FUNCTIONAL_TESTS" == "yes" ]]; then
echo;
export typo3DatabaseName="typo3";
export typo3DatabaseHost="localhost";
export typo3DatabaseUsername="root";
export typo3DatabasePassword="";
find . -wholename '*typo3/sysext/*/Tests/Functional/*Test.php' | parallel --jobs 6 --gnu 'echo; echo "Running functional test suite {}"; ./bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml {}'
fi
- >
if [[ "$ACCEPTANCE_TESTS" == "yes" ]]; then
export _JAVA_OPTIONS="-Xms1024m -Xmx1024m";
./bin/selenium-server-standalone >/dev/null 2>&1 &
php -S 0.0.0.0:8000 >/dev/null 2>&1 &
sleep 5;
export typo3DatabaseName="typo3";
export typo3DatabaseHost="localhost";
export typo3DatabaseUsername="root";
export typo3DatabasePassword="";
./bin/codecept run Acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml --debug
./bin/codecept run Acceptance -c typo3/sysext/core/Build/AcceptanceTests.yml
fi
- >
if [[ "$PHP_LINT" == "yes" ]]; then
echo;
echo "Running php lint";
find typo3/ -name \*.php -not -path "vendor/*" | parallel --jobs 6 --gnu php -d display_errors=stderr -l {} > /dev/null \;
fi
- >
if [[ "$XLF_CHECK" == "yes" ]]; then
echo;
echo "Running XLF checker";
./typo3/sysext/core/Build/Scripts/xlfcheck.sh
fi
- >
if [[ "$SUBMODULE_TEST" == "yes" ]]; then
echo;
echo "Running git submodule check";
/bin/bash -c "
if [[ `git submodule status 2>&1 | wc -l` -ne 0 ]]; then
echo \"Found a submodule definition in repository\";
Expand All @@ -105,7 +97,5 @@ script:
- >
if [[ "$EXCEPTIONCODE_TEST" == "yes" ]]; then
echo;
echo "Running duplicate exception code checker";
./typo3/sysext/core/Build/Scripts/duplicateExceptionCodeCheck.sh
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

DIR=$(realpath $(dirname "$0"))
PHP_VERSION=$(phpenv version-name)
ROOT=$(realpath "$DIR/../../../../../..")
PHP_FPM_BIN="$HOME/.phpenv/versions/$PHP_VERSION/sbin/php-fpm"
PHP_FPM_CONF="$DIR/php-fpm.conf"

# Start php-fpm
"$PHP_FPM_BIN" --fpm-config "$PHP_FPM_CONF"

# Build nginx config file and start nginx
sed -e "s|{ROOT}|$ROOT|g" < "$DIR/nginx.tpl.conf" > "$ROOT/nginx.conf"
nginx -c "$ROOT/nginx.conf"
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
error_log /tmp/error.log;
pid /tmp/nginx.pid;
worker_processes 1;

events {
worker_connections 1024;
}

http {
# Set an array of temp and cache file options that will otherwise default to restricted locations accessible only to root
client_body_temp_path /tmp/client_body;
fastcgi_temp_path /tmp/fastcgi_temp;
proxy_temp_path /tmp/proxy_temp;
scgi_temp_path /tmp/scgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;

# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;

# Logging Settings
access_log /tmp/access.log;

# Gzip Settings
gzip on;
gzip_disable "msie6";

server {
listen 8000 default_server;
listen [::]:8000 default_server ipv6only=on;

root {ROOT};

location / {
# First attempt to serve request as file, then as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}

location ~* "\.php(/|$)" {
include /etc/nginx/fastcgi_params;

fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SERVER_NAME $host;

fastcgi_pass 127.0.0.1:9000;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[travis]
listen = 9000
listen.mode = 0666
pm = static
pm.max_children = 5
request_terminate_timeout = 360s
php_admin_value[memory_limit] = 256M
3 changes: 2 additions & 1 deletion typo3/sysext/core/Tests/Acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ modules:
WebDriver:
url: http://localhost:8000/typo3temp/var/tests/acceptance
browser: phantomjs
port: 4444
port: 4445
window_size: 1440x570
wait: 1
restart: true
Expand All @@ -26,3 +26,4 @@ env:
config:
WebDriver:
browser: firefox
port: 4444

0 comments on commit 43fc083

Please sign in to comment.