aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2019-12-28 11:53:15 -0500
committerKevin J Hoerr <kjhoerr@protonmail.com>2019-12-28 11:53:15 -0500
commit21cc6c9748ea4567dee5f62f7f1dcc0b8cd1b069 (patch)
tree36776c9ee3b0333a0de4ecf92b4a23d3629cdef2 /public
parent16552bc9ffcef978684ec267e0ff9b22120cc799 (diff)
downloadao-coverage-21cc6c9748ea4567dee5f62f7f1dcc0b8cd1b069.tar.gz
ao-coverage-21cc6c9748ea4567dee5f62f7f1dcc0b8cd1b069.tar.bz2
ao-coverage-21cc6c9748ea4567dee5f62f7f1dcc0b8cd1b069.zip
#5 Add more descriptive output to bash script
Diffstat (limited to 'public')
-rw-r--r--public/bash.template44
1 files changed, 41 insertions, 3 deletions
diff --git a/public/bash.template b/public/bash.template
index 09831b7..08a5913 100644
--- a/public/bash.template
+++ b/public/bash.template
@@ -12,17 +12,37 @@ format="tarpaulin"
report=""
token="$COV_TOKEN"
-if [[ "$CI" == "drone" ]]; then
+function verbose_say() {
+ if [ -z "$QUIET" ] || [ "$VERBOSE" == "true" ]; then
+ echo "$1"
+ fi
+}
+
+verbose_say "==========================="
+verbose_say " ao-coverage "
+verbose_say "==========================="
+verbose_say
+
+verbose_say "Gathering report information . . ."
+
+if [ "$CI" == "drone" ]; then
+ verbose_say "Drone CI discovered - using Drone report info"
commit="$DRONE_COMMIT"
branch="$DRONE_BRANCH"
repo="$DRONE_REPO"
else
+ verbose_say "Using environment variables for report info"
commit="$VCS_COMMIT"
branch="$VCS_BRANCH"
repo="$VCS_REPO"
fi
-if [[ "$format" == "tarpaulin" ]]; then
+verbose_say "Using commit #: $commit"
+verbose_say "Using branch: $branch"
+verbose_say "Using repo: $repo"
+verbose_say
+
+if [ "$format" == "tarpaulin" ]; then
report="${REPORT_FILE:-tarpaulin-report.html}"
fi
@@ -31,4 +51,22 @@ if [[ ! -f "$report" ]]; then
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
+verbose_say "Uploading $report . . ."
+
+response=$(curl -X POST --data-binary "@$report" \
+ -H 'Content-Type: text/html' \
+ "$url/v1/$repo/$branch/$commit.html?token=$token&format=$format")
+
+if [ ! -z "$response" ]; then
+ echo "Error uploading report: $response"
+ exit 1
+else
+ echo "Successfully uploaded report!"
+ verbose_say
+ verbose_say "View uploaded report at: $url/v1/$repo/$branch/$commit.html"
+ verbose_say "View coverage badge at: $url/v1/$repo/$branch/$commit.svg"
+ verbose_say
+ verbose_say "Shorthand links are also available, as the latest commit of this branch."
+ verbose_say "View latest report for branch $branch: $url/v1/$repo/$branch.html"
+ verbose_say "View latest badge for branch $branch: $url/v1/$repo/$branch.svg"
+fi \ No newline at end of file