#!/bin/bash
set -evux

ARTIFACT_PATH="/artifacts/anastasis/lcov/${CI_COMMIT_REF}/anastasis"
mkdir -p /artifacts/anastasis/lcov/${CI_COMMIT_REF} # Variable comes from CI environment
lcov --ignore-errors version --capture --directory . --output-file coverage.info || exit 1
genhtml coverage.info --output-directory ${ARTIFACT_PATH} || exit 1


RSYNC_HOST="taler.host.internal"
RSYNC_PORT=424243
RSYNC_PATH="incoming_taler/"
RSYNC_DEST="rsync://${RSYNC_HOST}/${RSYNC_PATH}"


rsync -rvP \
      --port ${RSYNC_PORT} \
      ${ARTIFACT_PATH} ${RSYNC_DEST} || exit 1
