diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 736fbc308301184948c0984579fafe4306bd6f1d..a81b3b5aa6502ce075f89642dc997707a9fc7d7d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ # Defines stages which are to be executed stages: - syntax + - test # ### Stage syntax @@ -13,6 +14,7 @@ syntax:lint: only: - schedules - web + - merge_requests script: - composer require overtrue/phplint @@ -20,3 +22,17 @@ syntax:lint: - echo "For more information http://www.icosaedro.it/phplint/" - vendor/bin/phplint + +test:install: + stage: test + image: jerob/docker-ispconfig + only: + - schedules + - web + - merge_requests + script: + - $CI_PROJECT_DIR/helper_scripts/test_install_docker.sh + - apt-get update + - apt-get --yes install curl + - curl --insecure https://127.0.0.1:8080/login/ + - ps xaf diff --git a/helper_scripts/test_install_docker.sh b/helper_scripts/test_install_docker.sh new file mode 100755 index 0000000000000000000000000000000000000000..4de61c38957dff6ddd1ce9ae823ca93974cdcd18 --- /dev/null +++ b/helper_scripts/test_install_docker.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# This script is used from .gitlab-ci.yml to do an automated installation inside a docker container for testing. + +if [ -f /usr/local/ispconfig/interface/lib/config.inc.php ]; then + echo "Found an existing configfile, bailing out!" + exit 1 +fi + +mysql_install_db +service mysql start \ +&& echo "UPDATE mysql.user SET Password = PASSWORD('pass') WHERE User = 'root';" | mysql -u root \ +&& echo "UPDATE mysql.user SET plugin='mysql_native_password' where user='root';" | mysql -u root \ +&& echo "DELETE FROM mysql.user WHERE User='';" | mysql -u root \ +&& echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql -u root \ +&& echo "DROP DATABASE IF EXISTS test;" | mysql -u root \ +&& echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';" | mysql -u root \ +&& echo "FLUSH PRIVILEGES;" | mysql -u root +sed -i "s/^hostname=server1.example.com$/hostname=$HOSTNAME/g" /root/ispconfig3_install/install/autoinstall.ini + +service mysql start && php -q $CI_PROJECT_DIR/install/install.php --autoinstall=/root/ispconfig3_install/install/autoinstall.ini