Skip to content
Snippets Groups Projects

#3357986: Use apache as web server

Merged Fran Garcia-Linares requested to merge issue/gitlab_templates-3357986:1.0.x into 1.0.x
@@ -18,8 +18,9 @@
@@ -18,8 +18,9 @@
.test-variables:
.test-variables:
variables:
variables:
 
BROWSERTEST_OUTPUT_DIRECTORY: $CI_PROJECT_DIR/$_WEB_ROOT/sites/simpletest/browser_output
FF_NETWORK_PER_BUILD: 1
FF_NETWORK_PER_BUILD: 1
SIMPLETEST_BASE_URL: http://localhost:8888
SIMPLETEST_BASE_URL: http://localhost/$_WEB_ROOT
DB_DRIVER: mysql
DB_DRIVER: mysql
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysql
MYSQL_DATABASE: mysql
@@ -44,6 +45,13 @@
@@ -44,6 +45,13 @@
[[ $_TARGET_DB_TYPE == "mysql" ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "mysql" ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
 
.setup_webserver: &setup-webserver
 
- mkdir -p $BROWSERTEST_OUTPUT_DIRECTORY
 
- chmod -R 755 $BROWSERTEST_OUTPUT_DIRECTORY
 
- ln -s $CI_PROJECT_DIR/$_WEB_ROOT /var/www/html
 
- chown -R www-data:www-data $CI_PROJECT_DIR
 
- service apache2 start
 
################
################
# Set global defaults, including:
# Set global defaults, including:
# - interruptible:true, so that new pushes can stop the current job and start a new one
# - interruptible:true, so that new pushes can stop the current job and start a new one
@@ -258,11 +266,10 @@ eslint:
@@ -258,11 +266,10 @@ eslint:
DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES: node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest
DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES: node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest
DRUPAL_NIGHTWATCH_OUTPUT: reports/nightwatch
DRUPAL_NIGHTWATCH_OUTPUT: reports/nightwatch
script:
script:
 
- *setup-webserver
- *simpletest-db
- *simpletest-db
- export DRUPAL_TEST_DB_URL=$SIMPLETEST_DB
- export DRUPAL_TEST_DB_URL=$SIMPLETEST_DB
- *show-environment-variables
- *show-environment-variables
# @todo Use Apache instead of PHP web server.
- cd $_WEB_ROOT && php -S 0.0.0.0:8888 .ht.router.php >> webserver.log 2>&1 &
- yarn --cwd $_WEB_ROOT/core test:nightwatch $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/tests
- yarn --cwd $_WEB_ROOT/core test:nightwatch $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/tests
artifacts:
artifacts:
expire_in: 6 mos
expire_in: 6 mos
@@ -290,31 +297,27 @@ nightwatch:
@@ -290,31 +297,27 @@ nightwatch:
- .test-variables
- .test-variables
variables:
variables:
SYMFONY_DEPRECATIONS_HELPER: weak
SYMFONY_DEPRECATIONS_HELPER: weak
BROWSERTEST_OUTPUT_DIRECTORY: $CI_PROJECT_DIR/$_WEB_ROOT/sites/simpletest/browser_output
services:
services:
- <<: *with-database
- <<: *with-database
- <<: *with-chrome
- <<: *with-chrome
script:
script:
 
- *setup-webserver
- *simpletest-db
- *simpletest-db
- *show-environment-variables
- *show-environment-variables
- mkdir -p $BROWSERTEST_OUTPUT_DIRECTORY
- chmod -R 755 $BROWSERTEST_OUTPUT_DIRECTORY
- touch $_WEB_ROOT/webserver.log
# @todo Use Apache instead of PHP web server.
- cd $_WEB_ROOT && php -S 0.0.0.0:8888 .ht.router.php >> webserver.log 2>&1 &
# Provide some context on the test run.
# Provide some context on the test run.
- vendor/bin/drush status
- vendor/bin/drush status
# Finally, execute tests.
# Finally, execute tests.
- vendor/bin/phpunit --no-interaction --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --bootstrap $PWD/web/core/tests/bootstrap.php $_WEB_ROOT/modules/custom --log-junit junit.xml $_PHPUNIT_EXTRA
- sudo -u www-data -E vendor/bin/phpunit --no-interaction --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --bootstrap $PWD/web/core/tests/bootstrap.php $_WEB_ROOT/modules/custom --log-junit junit.xml $_PHPUNIT_EXTRA
 
- cp /var/log/apache2/test.apache.access.log $CI_PROJECT_DIR/apache.access.log.txt
artifacts:
artifacts:
expire_in: 6 mos
expire_in: 6 mos
expose_as: 'junit-browser_output-webserver_log'
expose_as: 'junit-browser_output-apache_log'
when: always
when: always
reports:
reports:
junit: junit.xml
junit: junit.xml
paths:
paths:
- junit.xml
- junit.xml
- $_WEB_ROOT/webserver.log
- apache.access.log.txt
- $BROWSERTEST_OUTPUT_DIRECTORY
- $BROWSERTEST_OUTPUT_DIRECTORY
phpunit:
phpunit:
Loading