From 6bbd3f03104e6dcd9da89a8ec5dcb5d992ee3ed5 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Thu, 16 Sep 2021 15:45:34 -0400 Subject: #7 Add Cobertura format --- public/templates/bash.template | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'public') diff --git a/public/templates/bash.template b/public/templates/bash.template index 4eb3a47..375143e 100644 --- a/public/templates/bash.template +++ b/public/templates/bash.template @@ -12,6 +12,8 @@ format="tarpaulin" report="" token="$COV_TOKEN" curl_verbosity="" +content_type="text/html" +extension="html" function verbose_say() { if [ -z "$SILENT" ] && [ "$VERBOSE" == "true" ]; then @@ -51,6 +53,10 @@ verbose_say if [ "$format" == "tarpaulin" ]; then report="${REPORT_FILE:-tarpaulin-report.html}" +elif [ "$format" == "cobertura" ]; then + report="${REPORT_FILE:-cobertura.xml}" + content_type="application/xml" + extension="xml" fi if [[ ! -f "$report" ]]; then @@ -65,9 +71,9 @@ fi say "Uploading $report . . ." response=$(curl -X POST --data-binary "@$report" \ - -H 'Content-Type: text/html' \ + -H "Content-Type: $content_type" \ $curl_verbosity \ - "$url/v1/$repo/$branch/$commit.html?token=$token&format=$format") + "$url/v1/$repo/$branch/$commit.$extension?token=$token&format=$format") if [ ! -z "$response" ]; then say "Error uploading report: $response" @@ -75,10 +81,10 @@ if [ ! -z "$response" ]; then else say "Successfully uploaded report!" say - say "View uploaded report at: $url/v1/$repo/$branch/$commit.html" + say "View uploaded report at: $url/v1/$repo/$branch/$commit.$extension" say "View coverage badge at: $url/v1/$repo/$branch/$commit.svg" say say "Shorthand links are also available, as the latest commit of this branch." - say "View latest report for branch $branch: $url/v1/$repo/$branch.html" + say "View latest report for branch $branch: $url/v1/$repo/$branch.$extension" say "View latest badge for branch $branch: $url/v1/$repo/$branch.svg" fi \ No newline at end of file -- cgit