Skip to content

Commit

Permalink
Merge #16120 - TravisCI config improvements
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed May 13, 2020
2 parents 80aaf95 + 9dea93f commit 401bcec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
22 changes: 11 additions & 11 deletions .travis.yml
Expand Up @@ -5,22 +5,14 @@ language: php
stages:
- name: "Lint and analyse code"
- name: "PHP Unit tests"
- name: "Documentation"
- name: "Other tests"
- name: "Documentation"

install:
- nvm install 10
- composer install --no-interaction
- yarn install --non-interactive

before_script:
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
- export TESTSUITE_BROWSERSTACK_KEY=`echo cHlDcHJTNmZwZjVlaUR2RmV6VkU= | base64 --decode`
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test"
- mysql -uroot < sql/create_tables.sql
- mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')"
- ./test/start-local-server

script:
- ./scripts/generate-mo --quiet
- ./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium
Expand All @@ -29,7 +21,6 @@ after_script:
- if [ -f php.log ] ; then cat php.log ; fi
- if [ -f nginx-error.log ] ; then cat nginx-error.log ; fi
- if [ -f config.inc.php ] ; then rm -rf config.inc.php; fi
- if [ "$CI_MODE" = "selenium" ] ; then ~/browserstack/BrowserStackLocal --daemon stop; fi

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down Expand Up @@ -213,13 +204,22 @@ jobs:
- TESTSUITE_SELENIUM_BROWSER=chrome
- TESTSUITE_USER=root
- TESTSUITE_URL=http://127.0.0.1:8000
before_script:
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
- export TESTSUITE_BROWSERSTACK_KEY=`echo cHlDcHJTNmZwZjVlaUR2RmV6VkU= | base64 --decode`
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test"
- mysql -uroot < sql/create_tables.sql
- mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')"
- ./test/start-local-server
after_script:
- ~/browserstack/BrowserStackLocal --daemon stop
before_install: phpenv config-rm xdebug.ini
install:
- nvm install 10
- ./test/install-browserstack
- composer install --no-interaction
- yarn install --non-interactive
- echo -e "<?php\n\$cfg['UploadDir'] = './test/test_data/';" > config.inc.php
- cp test/config.e2e.inc.php config.inc.php
script: ./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium --verbose --debug
addons:
apt:
Expand Down
9 changes: 9 additions & 0 deletions test/config.e2e.inc.php
@@ -0,0 +1,9 @@
<?php
$cfg['FilterLanguages'] = '^(en)$';
$cfg['Lang'] = 'en';
$i = 0;
$cfg['Servers'] = [];
$i++;
$cfg['Servers'][$i]['verbose'] = 'Local';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['UploadDir'] = './test/test_data/';
2 changes: 2 additions & 0 deletions test/nginx.conf
Expand Up @@ -49,6 +49,8 @@ http {
access_log off;

server {
access_log %ROOT%/nginx-access.log;
error_log %ROOT%/nginx-error.log error;
listen 8000 default_server;
server_name _;

Expand Down
8 changes: 5 additions & 3 deletions test/start-local-server
Expand Up @@ -9,7 +9,7 @@ fi
set -e
set -x

if [ "$CI_MODE" != "selenium" -o -z "$TESTSUITE_BROWSERSTACK_KEY" ] ; then
if [ "$CI_MODE" != "selenium" ] ; then
exit 0
fi

Expand All @@ -27,5 +27,7 @@ mkdir $DIR/sessions
$HOME/.phpenv/versions/$PHP_VERSION/sbin/php-fpm --fpm-config $DIR/php-fpm.conf -c $DIR/php.ini
nginx -c $DIR/nginx.conf

# Start BrowserStack Local forwarder
~/browserstack/BrowserStackLocal --force-local --localIdentifier "travis-$TRAVIS_JOB_NUMBER" --onlyAutomate --key "$TESTSUITE_BROWSERSTACK_KEY" --daemon start
if [ ! -z "$TESTSUITE_BROWSERSTACK_KEY" ] ; then
# Start BrowserStack Local forwarder
~/browserstack/BrowserStackLocal --force-local --localIdentifier "travis-$TRAVIS_JOB_NUMBER" --onlyAutomate --key "$TESTSUITE_BROWSERSTACK_KEY" --daemon start
fi

0 comments on commit 401bcec

Please sign in to comment.