Support using this script to test AWL as well

This commit is contained in:
Andrew Ruthven 2024-02-25 19:03:57 +13:00
parent d7d7dd2ade
commit 5bd6d70383

View File

@ -1,10 +1,16 @@
#!/bin/bash
# Configure the virtual environment that Gitlab provides for our CI jobs.
#
# This supports being used for either AWL or DAViCal. To test AWL we run
# the DAViCal regression tests as that is the best thing we have to exercise
# AWL currently.
set -e
set -x
davical_repo_path=$CI_PROJECT_DIR
mode=${1:-$CI_JOB_NAME}
ldap=0
@ -72,11 +78,11 @@ fi
apt-get -y install $packages
###
### Setup PHP for we're using latestphp...
### Setup PHP if we're using latestphp...
###
if [[ $mode =~ "latestphp" ]]; then
# The image doesn't install debs, so ignore the dependencies.
# The image doesn't install PHP from debs, so ignore the dependencies.
dpkg_ignore_depends="$dpkg_ignore_depends,php,php-pgsql,php-xml,php-cli"
docker-php-ext-install -j$(nproc) pgsql
@ -84,9 +90,9 @@ if [[ $mode =~ "latestphp" ]]; then
docker-php-ext-install -j$(nproc) calendar
# The PHP 8.2 container has deflate enabled in Apache2, disable it.
# This is causes a test to fail because we're being sent a gzip
# compressed result. My reading of the curl manpage says that it should
# be decompressed by curl, but it isn't. Let's just disable the deflate
# This causes a test to fail because we're being sent a gzip compressed
# result. My reading of the curl manpage says that it should be
# decompressed by curl, but it isn't. Let's just disable the deflate
# module.
a2dismod -f deflate
fi
@ -113,22 +119,42 @@ if [ $ldap == 1 ]; then
fi
###
### Install the latest build of AWL
### If testing DAViCal, grab the git repo of AWL so we're using the latest
### code.
###
curl https://gitlab.com/davical-project/awl/-/archive/master/awl-master.tar.gz \
| tar zxf -
mv awl-master /usr/share/awl/
chown -R www-data /usr/share/awl/
if [ -f davical.spec.in ]; then
curl https://gitlab.com/davical-project/awl/-/archive/master/awl-master.tar.gz \
| tar zxf -
mv awl-master /usr/share/awl/
chown -R www-data /usr/share/awl/
fi
###
### Install the davical and libawl-php packages to test
### If testing AWL, grab the git repo of DAViCal for the tests we'll use.
###
dpkg --ignore-depends=$dpkg_ignore_depends -i *.deb
if [ -f php-awl.spec.in ]; then
curl https://gitlab.com/davical-project/davical/-/archive/master/davical-master.tar.gz \
| tar zxf -
ln -s . awl
mkdir /usr/share/davical/testing/
cp testing/*.php /usr/share/davical/testing/
davical_repo_path="$CI_PROJECT_DIR/davical-master"
ln -s /usr/share/davical $davical_repo_path
fi
###
### If testing DAViCal install the davical and libawl-php packages to test
###
if [ -f davical.spec.in ]; then
dpkg --ignore-depends=$dpkg_ignore_depends -i *.deb
fi
mkdir -p /usr/share/davical/testing/
cp $davical_repo_path/testing/*.php /usr/share/davical/testing/
mkdir -p /var/log/davical
chown www-data /var/log/davical
@ -136,8 +162,11 @@ chown www-data /var/log/davical
### Setup DAViCal config files
###
rm /etc/davical/config.php
eval cat testing/regression-conf.php.example \
# When testing DAViCal, the file already exists, when testing AWL the
# directory is missing.
rm -f /etc/davical/config.php
mkdir -p /etc/davical
eval cat $davical_repo_path/testing/regression-conf.php.example \
\| sed 's.//\$c-\>dbg.\$c-\>dbg.' \
$conf_filter_memcache \
$conf_filter_ldap \
@ -170,6 +199,8 @@ useradd testrunner
# for the memcache tests.
adduser testrunner adm
chown -R testrunner $davical_repo_path/testing
###
### Configure Apache2
###
@ -179,26 +210,34 @@ echo '127.0.1.1 regression mycaldav mycaldav_ldap myempty' >> /etc/hosts
rm /etc/apache2/ports.conf /etc/apache2/sites-enabled/000-default.conf \
&& touch /etc/apache2/ports.conf
cp testing/apache-site.conf.example \
/etc/apache2/sites-enabled/davical-regression.conf
sed -i 's/\/path\/to/\/usr\/share/g' \
cp $davical_repo_path/testing/apache-site.conf.example \
/etc/apache2/sites-enabled/davical-regression.conf
if [ -f php-awl.spec.in ]; then
sed -i "s,/path/to/awl,$CI_PROJECT_DIR,;
s,/path/to/davical,$davical_repo_path," \
/etc/apache2/sites-enabled/davical-regression.conf
else
sed -i 's/\/path\/to/\/usr\/share/g' \
/etc/apache2/sites-enabled/davical-regression.conf
fi
a2enmod rewrite
a2enmod headers
apache2ctl start
# Ensure that the jobs that need to drop in static files for Apache to serve
# up can do so.
mkdir /usr/share/davical/htdocs/testfiles
mkdir -p /usr/share/davical/htdocs/testfiles
chown testrunner /usr/share/davical/htdocs/testfiles
ln -s /usr/share/davical/htdocs/testfiles htdocs
ln -s /usr/share/davical/htdocs/testfiles $davical_repo_path/htdocs
###
### Set up for carddavclientinterop
###
if [ $interop == 1 ]; then
cd $davical_repo_path
curl https://codeload.github.com/mstilkerich/carddavclient/tar.gz/master | tar zxf -
cd carddavclient-master