Add db installation to workflow

Change-Id: Ib8916434f33fa9887763fd53f06cbbbc153b26d0
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6fa466..57a128b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,22 +2,34 @@
 
 build:
   stage: build
-  before_script:   
+  before_script:
     - apt-get update
-    - apt-get install -y git redis ocrad imagemagick libpng-dev zlib1g-dev zlib1g-dev libzip-dev unzip
+    - apt-get install -y git redis ocrad imagemagick libpng-dev zlib1g-dev zlib1g-dev libzip-dev unzip mariadb-server
     - docker-php-ext-install zip
-    - docker-php-ext-install gd
+    - docker-php-ext-install gd pdo pdo_mysql
     - curl -sS https://getcomposer.org/installer -o composer-setup.php
     - php composer-setup.php --install-dir=/usr/local/bin --filename=composer
     - pear install mail
     - pear install Net_SMTP
     - pear install Auth_SASL
     - pear install mail_mime
+    - composer config github-oauth.github.com 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
     - composer install
     - mv config.php.example config.php
     - rm -rf /var/www/html
     - ln -s $CI_PROJECT_DIR /var/www/html
+    - mkdir -p $CI_PROJECT_DIR/logs
+    - chmod a+rwX $CI_PROJECT_DIR/logs
+    - ls -lrtR $CI_PROJECT_DIR
     - service apache2 start
+    - echo "DB SET UP:"
+    - service mariadb start
+    - mysql --user=root --host=localhost --execute "CREATE DATABASE signup;" 
   script:
+    - cat create_user_table.sql | mysql --user=root --host=localhost -D signup
+    - echo "ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('mysqlpassword');" | mysql --user=root --host=localhost -D signup
     - curl -s "http://localhost/" | grep Username
-    - curl -s "http://localhost/?type=recover" | grep -e 'Reset your .* password'
+    - curl -s "http://localhost/?type=recover" | grep -i Reset
+    - sed -i 's/CONFERENCE_REGISTRATION *= *false/CONFERENCE_REGISTRATION = true/' config.php
+    - curl -s "http://localhost/" | grep "places left"
+