From 85d646880e1e3fef1d9547b72c2d0107e3465d90 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Mon, 9 Dec 2019 18:11:26 -0500 Subject: Add template process to serve bash file Unfortunately, a static file can't really be used to serve the connection - the host address is needed to link back to the server. Only a light library is needed to handle the template file though, and if more are needed in the future it should be a non-trivial task to add them to the process. By default I'm configuring this to work with drone.io, since that is the CI that I personally will be using (most likely). It should be non-trivial to configure other CI to handle the script as well. --- public/bash.template | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 public/bash.template (limited to 'public/bash.template') diff --git a/public/bash.template b/public/bash.template new file mode 100644 index 0000000..c7f95bc --- /dev/null +++ b/public/bash.template @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# ISC License +# The full version of this license can be found here: +# https://git.submelon.dev/kjhoerr/ao-coverage/raw/branch/trunk/LICENSE + +url="{{TARGET_URL}}" +commit="" +branch="" +repo="" +format="tarpaulin" +report="" +token="$COV_TOKEN" + +if [[ "$CI" -eq "drone" ]]; then + commit="$DRONE_COMMIT" + branch="$DRONE_BRANCH" + repo="$DRONE_REPO" +else + commit="$VCS_COMMIT" + branch="$VCS_BRANCH" + repo="$VCS_REPO" +fi + +if [[ "$format" -eq "tarpaulin" ]]; then + report="${REPORT_FILE:-tarpaulin-report.html}" +fi + +if [[ ! -f "$report" ]]; then + echo "Report file could not be found." + exit 1 +fi + +curl -X POST --data-binary "@$report" -H 'Content-Type: text/html' "$url/v1/$repo/$branch/$commit.html?token=$token&format=tarpaulin" \ No newline at end of file -- cgit