Add Gitlab CI

Signed-off-by: Jamie McClymont <jamiemcclymont@catalyst.net.nz>
This commit is contained in:
Jamie McClymont committed 2018-11-30 15:59:04 +13:00
1 parent 0e0a07eb30
commit a4c9718bb2
6 files changed
+210 -1

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
Listen 127.0.1.1:80
<VirtualHost 127.0.1.1:80>
ServerName regression
ServerAlias myempty mycaldav
DocumentRoot /path/to/davical/htdocs
CustomLog ${APACHE_LOG_DIR}/regression-access.log combined
ErrorLog ${APACHE_LOG_DIR}/regression-error.log
Alias /davical /path/to/davical/htdocs
<Directory /path/to/davical/htdocs>
Require all granted
DirectoryIndex index.php index.html
php_value include_path /path/to/awl/inc:/path/to/davical/testing
</Directory>
RewriteEngine On
# Redirect /.well-known URLs
RewriteRule ^/\.well-known/(.*)$ /caldav.php/.well-known/$1 [NC,L]
# and other special URLs
RewriteRule ^/principals/users/(.*)$ /caldav.php/$1 [NC,L]
RewriteRule ^/principals/resources/(.*)$ /caldav.php/$1 [NC,L]
RewriteRule ^/calendars/__uids__/(.*)$ /caldav.php/$1 [NC,L]
RewriteRule ^/addressbooks/__uids__/(.*)$ /caldav.php/$1 [NC,L]
# let caldav.php handle "anything else"
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !\.(php|css|png|gif|js|jpg|ico)
RewriteRule ^(.*)$ /caldav.php$1 [NC,L]
</VirtualHost>
+22
View File
@@ -0,0 +1,22 @@
<?php
$c->pg_connect[] = 'dbname=regression user=davical_app';
// use strict result ordering for regression testing only
$c->strict_result_ordering = true;
// PUT: 405 Method Not Allowed
$c->readonly_webdav_collections = false;
// fix ETag differences (CRLF) in 0218-Moz-REPORT and later
$c->hide_alarm = true;
// some freebusy queries will be 404 otherwise
$c->public_freebusy_url = true;
// helps with 1035-GET-mashup
$c->get_includes_subcollections = true;
// helps with 1036-REPORT-sync-initial-bound
$c->hide_TODO = false;
// for ischedule suite; also needs DKIM set up?
$c->enable_scheduling = true;
// enable for debugging, as needed
//$c->dbg['ALL'] = 1;
?>
+75
View File
@@ -0,0 +1,75 @@
setup_report() {
if [ ! -z "$IS_CI" ]; then
cat > "$REPORTFILE" <<EOHEADER
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
</testsuites>
EOHEADER
fi
}
report_test_success() {
if [ ! -z "$IS_CI" ]; then
SUITEPATH="/testsuites/testsuite[@name=\"$SUITE\"]"
xmlstarlet ed -L \
-s "$SUITEPATH" -t elem -n testcase \
-i "$SUITEPATH/testcase[not(@name)]" -t attr -n wip -v "1" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n name -v "$TEST" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n classname -v "$TEST" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n timestamp -v "0" \
-d "$SUITEPATH/testcase[@wip]/@wip" \
"$REPORTFILE"
fi
}
report_test_failure() {
if [ ! -z "$IS_CI" ]; then
SUITEPATH="/testsuites/testsuite[@name=\"$SUITE\"]"
xmlstarlet ed -L \
-s "$SUITEPATH" -t elem -n testcase \
-i "$SUITEPATH/testcase[not(@name)]" -t attr -n wip -v "1" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n name -v "$SUITE: $TEST" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n classname -v "$TEST" \
-i "$SUITEPATH/testcase[@wip]" -t attr -n timestamp -v "0" \
-s "$SUITEPATH/testcase[@wip]" -t elem -n failure -v "xxxPERL_REPLACE_THIS_WITH_THE_ESCAPED_DIFFxxx" \
-i "$SUITEPATH/testcase[@wip]/failure" -t attr -n message -v "test failure" \
-d "$SUITEPATH/testcase[@wip]/@wip" \
"$REPORTFILE"
# I encountered a bug in xmlstarlet where small sections of large files are not properly escaped if inserted directly :/
perl -pi -e 'BEGIN {$diff = `xmlstarlet esc < "'"${REGRESSION}/diffs/${TEST}"'"`} s/xxxPERL_REPLACE_THIS_WITH_THE_ESCAPED_DIFFxxx/$diff/g' "$REPORTFILE"
fi
}
report_suite_setup() {
if [ ! -z "$IS_CI" ]; then
xmlstarlet ed -L \
-s '/testsuites' -t elem -n testsuite \
-i '/testsuites/testsuite[not(@name)]' -t attr -n name -v "$SUITE" \
-i '/testsuites/testsuite[not(@time)]' -t attr -n time -v "0" \
-i '/testsuites/testsuite[not(@errors)]' -t attr -n errors -v "0" \
-i '/testsuites/testsuite[not(@timestamp)]' -t attr -n timestamp -v "$(date -u +'%FT%TZ')" \
"$REPORTFILE"
fi
}
report_suite_counts() {
if [ ! -z "$IS_CI" ]; then
xmlstarlet ed -L \
-i "/testsuites/testsuite[@name=\"$SUITE\"]" -t attr -n tests -v "$(xmlstarlet sel -t -v "count(/testsuites/testsuite[@name=\"$SUITE\"]/testcase)" "$REPORTFILE")" \
-i "/testsuites/testsuite[@name=\"$SUITE\"]" -t attr -n failures -v "$(xmlstarlet sel -t -v "count(/testsuites/testsuite[@name=\"$SUITE\"]/testcase/failure)" "$REPORTFILE")" \
"$REPORTFILE"
fi
}
exit_based_on_reported_failures() {
if [ ! -z "$IS_CI" ]; then
FAILCOUNT="$(xmlstarlet sel -t -v "count(//failure)" "$REPORTFILE")"
if [ "$FAILCOUNT" -gt 0 ]; then
exit 2
else
exit 0
fi
fi
exit 0
}
+13 -1
View File
@@ -12,6 +12,7 @@
DBNAME=regression
PGPOOL=inactive
HOSTNAME=mycaldav
REPORTFILE=report.xml
# We need to run the regression tests in the timezone they were written for.
export PGTZ=Pacific/Auckland
@@ -49,6 +50,7 @@ ACCEPT_ALL=${2:-""}
# psql ${PSQLOPTS} -l
. ./regression_reporting.sh
check_result() {
TEST="$1"
@@ -59,6 +61,7 @@ check_result() {
diff --text -u "${REGRESSION}/${TEST}.result" "${RESULTS}/${TEST}" >"${REGRESSION}/diffs/${TEST}"
if [ -s "${REGRESSION}/diffs/${TEST}" ] ; then
report_test_failure
if [ -z "$SKIPDIFF" ]; then
echo "======================================="
echo "Displaying diff for test ${TEST}"
@@ -75,7 +78,7 @@ check_result() {
cp "${RESULTS}/${TEST}" "${REGRESSION}/${TEST}.result"
elif [ "${ACCEPT}" = "x" ]; then
echo "./dav_test --dsn '${DSN}' ${WEBHOST} ${ALTHOST} --suite '${SUITE}' --case '${TEST}' --debug"
exit
if [ -z "$IS_CI" ]; then exit 2; fi
elif [ "${ACCEPT}" = "v" ]; then
echo "Showing test $REGRESSION/${TEST}.test"
cat "$REGRESSION/${TEST}.test"
@@ -107,6 +110,7 @@ check_result() {
return 1
fi
else
report_test_success
echo "Test ${TEST} passed OK!"
fi
return 0
@@ -184,6 +188,8 @@ run_regression_suite() {
mkdir -p "${RESULTS}"
mkdir -p "${REGRESSION}/diffs"
report_suite_setup
if [ -f "${REGRESSION}/initial.dbdump" ]; then
restore_database
else
@@ -217,6 +223,8 @@ run_regression_suite() {
TCOUNT="$(( ${TCOUNT} + 1 ))"
done
report_suite_counts
}
@@ -224,6 +232,8 @@ run_regression_suite() {
TSTART="`date +%s`"
TCOUNT=0
setup_report
if [ "${SUITE}" = "all" ]; then
for SUITE in ${ALLSUITES} ; do
echo "Running $SUITE"
@@ -241,3 +251,5 @@ fi
TFINISH="`date +%s`"
echo "Regression test run took $(( ${TFINISH} - ${TSTART} )) seconds for ${TCOUNT} tests."
exit_based_on_reported_failures