Skip to content

Commit

Permalink
Add davical to CI system
Browse files Browse the repository at this point in the history
  • Loading branch information
mstilkerich committed Jan 2, 2022
1 parent 05a47ab commit 6838ee2
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 17 deletions.
12 changes: 7 additions & 5 deletions .github/scripts/createabook.sh
Expand Up @@ -21,20 +21,22 @@ if [ -n "$ABOOKDISP" ]; then
ABOOKDISP="<displayname>${ABOOKDISP}</displayname>"
fi
if [ -n "$ABOOKDESC" ]; then
ABOOKDESC="<CR:addressbook-description>${ABOOKDESC}</CR:addressbook-description>"
ABOOKDESC="<CARD:addressbook-description>${ABOOKDESC}</CARD:addressbook-description>"
fi

curl --no-progress-meter $AUTH -X MKCOL "$ABOOKURL" --data \
curl --no-progress-meter $AUTH -X MKCOL "$ABOOKURL" \
-H 'Content-Type: application/xml' \
--data \
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<create xmlns=\"DAV:\" xmlns:CR=\"urn:ietf:params:xml:ns:carddav\">
<mkcol xmlns=\"DAV:\" xmlns:CARD=\"urn:ietf:params:xml:ns:carddav\">
<set>
<prop>
<resourcetype>
<collection />
<CR:addressbook />
<CARD:addressbook />
</resourcetype>
$ABOOKDISP
$ABOOKDESC
</prop>
</set>
</create>"
</mkcol>"
51 changes: 51 additions & 0 deletions .github/scripts/deployDavical.sh
@@ -0,0 +1,51 @@
#!/bin/bash

set -e

BASEDIR=/var/www/html/davical

sudo apt-get update
sudo apt-get install -y apache2 libapache2-mod-php postgresql-client libyaml-perl libdbd-pg-perl libdbi-perl php php-pgsql php-imap php-curl php-cgi php-xml

wget -O awl.tar.xz https://www.davical.org/downloads/awl_0.62.orig.tar.xz
wget -O davical.tar.xz https://www.davical.org/downloads/davical_1.1.10.orig.tar.xz

for dist in awl davical; do
DISTDIR="$BASEDIR/$dist"
sudo mkdir -p "$DISTDIR"
sudo tar -xf $dist.tar.xz -C "$DISTDIR"
sudo chown -R root:www-data "$DISTDIR"
sudo find "$DISTDIR" -type d -exec chmod u=rwx,g=rx,o=rx '{}' \;
sudo find "$DISTDIR" -type f -exec chmod u=rw,g=r,o=r '{}' \;
done

# Setup database
# The davical scripts assume they can just run the postgres CLI commands as user with full DB access
if [ -f "$HOME/.pgpass" ]; then
echo "pgpass already exists - skipping"
else
echo "*:*:*:${PGUSER}:postgres" > "$HOME/.pgpass"
chmod 600 "$HOME/.pgpass"
fi

cd "$BASEDIR/davical/dba"
./create-database.sh davical admin postgres postgres

# Configure davical
sudo echo "127.0.0.1 davical.localdomain" >> /etc/hosts

sudo sed -e '1i <VirtualHost *:80>' \
-e "s,/usr/share/,$BASEDIR/,g" \
-e '$ a </VirtualHost>' \
"$BASEDIR/davical/config/apache-davical.conf" >/etc/apache2/sites-available/davical.conf
sudo a2ensite davical
sudo systemctl restart apache2

sudo cat << EOF >"$BASEDIR/davical/config/config.php"
<?php
\$c->domain_name = "davical.localdomain";
\$c->sysabbr = 'DAViCal';
\$c->system_name = "DAViCal Server";
\$c->pg_connect[] = 'dbname=davical host=$PGHOST port=5432 user=$PGUSER password=postgres';
EOF

46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -126,3 +126,49 @@ jobs:
flags: interop
name: Carddavclient radicale interoperability test coverage
fail_ci_if_error: false

interop-davical:
runs-on: ubuntu-20.04

env:
XDEBUG_MODE: coverage
CARDDAVCLIENT_INTEROP_SRV: Davical
PGHOST: localhost
PGUSER: postgres

services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--name postgres
ports:
- 5432:5432

steps:
- name: Checkout carddavclient
uses: actions/checkout@v2
- name: Set up CI environment
uses: ./.github/actions/setup
with:
php-version: '8.0'
- name: Setup Davical
run: |
.github/scripts/deployDavical.sh
- name: Create Davical Addressbooks
run: |
.github/scripts/createabook.sh "http://davical.localdomain/davical/caldav.php/admin/book1/" 'Test addressbook' 'Davical test addresses' admin admin
- name: Run interop tests
run: make tests-interop
- name: Upload interop-radicale test coverage reports to codecov.io
uses: codecov/codecov-action@v1
with:
file: testreports/interop/clover.xml
flags: interop
name: Carddavclient radicale interoperability test coverage
fail_ci_if_error: false
24 changes: 12 additions & 12 deletions tests/interop/AccountData.php.dist
Expand Up @@ -52,6 +52,13 @@ final class AccountData
"featureSet" => TestInfrastructureSrv::SRVFEATS_GOOGLE,
],
*/
"Davical" => [
"username" => "admin",
"password" => "admin",
"discoveryUri" => "http://davical.localdomain/davical",
"syncAllowExtraChanges" => false,
"featureSet" => TestInfrastructureSrv::SRVFEATS_DAVICAL,
],
"Nextcloud" => [
"username" => "ncadm",
"password" => "ncadmPassw0rd",
Expand Down Expand Up @@ -88,13 +95,6 @@ final class AccountData
"syncAllowExtraChanges" => false,
"featureSet" => TestInfrastructureSrv::SRVFEATS_SABRE,
],
"Davical" => [
"username" => "davicalUser",
"password" => "foobar",
"discoveryUri" => "http://localhost/davical",
"syncAllowExtraChanges" => false,
"featureSet" => TestInfrastructureSrv::SRVFEATS_DAVICAL,
],
"Synology" => [
"username" => "xxx",
"password" => "yyy",
Expand All @@ -119,6 +119,11 @@ final class AccountData
"displayname" => "Address Book",
],
*/
"Davical_0" => [
"account" => "Davical",
"url" => "http://davical.localdomain/davical/caldav.php/admin/book1/",
"displayname" => "Test addressbook",
],
"Nextcloud" => [
"account" => "Nextcloud",
"url" => "http://localhost:8080/remote.php/dav/addressbooks/users/ncadm/contacts/",
Expand Down Expand Up @@ -157,11 +162,6 @@ final class AccountData
"account" => "BaikalKrb",
"url" => "http://baikal.example.com/dav.php/addressbooks/baikalUser/default/",
"displayname" => "Default Address Book",
],
"Davical_0" => [
"account" => "Davical",
"url" => "http://localhost/davical/caldav.php/davicalUser/addresses/",
"displayname" => "Test addressbook",
],
*/
];
Expand Down

0 comments on commit 6838ee2

Please sign in to comment.