aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/bash.template34
1 files changed, 34 insertions, 0 deletions
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