aboutsummaryrefslogtreecommitdiff
path: root/public/bash.template
blob: bfaaae2a5c3a9bf5da31ccee730c553879df92fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash

# Licensed under Parity Public License 7.0.0
# The full version of this license can be found here:
# https://git.submelon.dev/kjhoerr/ao-coverage/raw/branch/trunk/LICENSE.md

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"