tests: test alarms and led coordination through sysrepo-ietf-alarms

Depends-On: https://gerrit.cesnet.cz/c/CzechLight/sysrepo-ietf-alarms/+/6052
Change-Id: If964baf29774dc1aa15f5e87887b269d832f3e5a
diff --git a/ci/build.sh b/ci/build.sh
index 04d9f6d..a8d33b0 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -71,10 +71,24 @@
 
 curl ${ARTIFACT_URL} | unzstd --stdout | tar -C ${PREFIX} -xf -
 
+# build sysrepo-ietf-alarms project (for tests)
+BUILD_SYSREPO_IETF_ALARMS=~/build-alarms
+mkdir ${BUILD_SYSREPO_IETF_ALARMS}
+pushd ${BUILD_SYSREPO_IETF_ALARMS}
+cmake -GNinja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} -DCMAKE_INSTALL_PREFIX=${PREFIX} ${ZUUL_PROJECT_SRC_DIR}/../sysrepo-ietf-alarms
+ninja-build install
+popd
+
 cd ${BUILD_DIR}
 cmake -GNinja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} -DCMAKE_INSTALL_PREFIX=${PREFIX} ${CMAKE_OPTIONS} ${ZUUL_PROJECT_SRC_DIR}
 ninja-build
+
+set_save=$-
+set -E
+trap "echo sysrepo-ietf-alarmsd test failed, copying log; cp ${BUILD_DIR}/sysrepo-ietf-alarmsd.log ~/zuul-output/logs" ERR
 ctest -j${CI_PARALLEL_JOBS} --output-on-failure
+trap - ERR
+set +E -$set_save
 
 if [[ $JOB_PERFORM_EXTRA_WORK == 1 ]]; then
     ninja-build doc
diff --git a/ci/pre.yaml b/ci/pre.yaml
index 2746d25..36a55ae 100644
--- a/ci/pre.yaml
+++ b/ci/pre.yaml
@@ -23,3 +23,15 @@
         name: docopt-cpp-devel
         state: present
       become: true
+
+    - name: install date-devel
+      package:
+        name: date-devel
+        state: present
+      become: true
+
+    - name: install libdate-tz
+      package:
+        name: libdate-tz
+        state: present
+      become: true