Commit e46c2dc4 authored by Aaron Barnes's avatar Aaron Barnes

jenkins: Add Jenkins test script and default config

parent 0606d535
<?php
$JOBNAME = basename(dirname(dirname(__DIR__)));
$cfg = new stdClass();
$branch = 'master';
// database connection details
$cfg->dbtype = 'postgres';
$cfg->dbhost = 'localhost';
$cfg->dbuser = 'jenkins';
$cfg->dbname = $JOBNAME;
$cfg->dbpass = 'huds13!';
$cfg->dataroot = "/var/lib/jenkins/sitedata/{$JOBNAME}";
$cfg->sendemail = true;
$cfg->sendallemailto = 'never@example.com';
$cfg->productionmode = false;
$cfg->perftofoot = true;
// Behat config
$cfg->dbprefix = ''; // Behat complains without this
$cfg->wwwroot = "http://127.0.0.1/{$JOBNAME}";
$cfg->behat_dbprefix = 'behat_'; // must not empty
$cfg->behat_dataroot = "/var/lib/jenkins/sitedata/behat_{$JOBNAME}";
$cfg->behat_wwwroot = "http://{$JOBNAME}.localhost:8000";
unset($JOBNAME);
#!/bin/bash
# Quit on error
set -e
MAXBEHIND=30
echo ""
echo "########## Check the patch is less than $MAXBEHIND patches behind master"
echo ""
git fetch origin master
echo ""
BEHINDBY=`git rev-list HEAD..origin/$GERRIT_BRANCH | wc -l`
echo "This patch is behind master by $BEHINDBY commit(s)"
[[ "$BEHINDBY" -lt "$MAXBEHIND" ]] || { echo "This patch is too far behind master, please rebase"; exit 1; }
echo ""
echo "########## Run make minaccept"
echo ""
make minaccept
echo ""
echo "########## Run install"
echo ""
dropdb $JOB_NAME
rm -Rf $HOME/elearning/sitedata/$JOB_NAME/*
rm -Rf $HOME/elearning/sitedata/behat_$JOB_NAME/*
createdb -O jenkins -E utf8 $JOB_NAME
cd htdocs
cp /home/catadmin/mahara_config.php config.php
php admin/cli/install.php --adminpassword='password' --adminemail=never@example.com
cd ..
echo ""
echo "########## Install composer"
echo ""
cd external
curl -sS https://getcomposer.org/installer | php
php composer.phar update
cd ..
echo ""
echo "########## Run unit tests"
echo ""
external/vendor/bin/phpunit htdocs/
echo ""
echo "########## Run Behat"
echo ""
# ensure selenium server is running
if ! [[ `ps aux | grep "[s]elenium-server-standalone"` ]]
then
currentdisplay=$DISPLAY
export DISPLAY=:10
# we want to run selenium headless on a different display - this allows for that ;)
echo "Starting Xvfb ..."
Xvfb :10 -ac > /dev/null 2>&1 & echo "PID [$!]"
fi
test/behat/mahara_behat.sh run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment