-
Notifications
You must be signed in to change notification settings - Fork 367
/
createcoveragereport.sh
executable file
·67 lines (55 loc) · 1.52 KB
/
createcoveragereport.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e
source toolversions.sh
if [ ! -d coverage ]
then
mkdir coverage
fi
rm -f coverage/all.dvcr
if ! compgen -G "coverage/*.dvcr" > /dev/null
then
echo "No coverage reports found to merge."
# This isn't an error
exit 0
fi
install_dotcover
install_reportgenerator
upload_report=false
while (( "$#" )); do
if [[ "$1" == "--upload" ]]
then
upload_report=true
elif [[ "$1" == "--upload_reportname" ]]
then
shift
# No further actions right now
elif [[ "$1" == "--upload_commit" ]]
then
shift
# No further actions right now
elif [[ "$1" == "--upload_build" ]]
then
shift
# No further actions right now
else
echo "Unexpected param: $1"
exit 1
fi
shift
done
echo "Merging reports..."
$DOTCOVER merge --Source="$(echo coverage/*.dvcr | sed 's/ /;/g')" --Output=coverage/all.dvcr ""
echo "Generating detailed xml report..."
$DOTCOVER report --Source=coverage/all.dvcr --Output=coverage/coverage.xml --ReportType=DetailedXML ""
# We assume the tools solution has already been restored as part of the build
echo "Filtering xml report..."
dotnet run --project tools/Google.Cloud.Tools.TrimCoverageReport/Google.Cloud.Tools.TrimCoverageReport.csproj -- coverage/coverage.xml coverage/coverage-filtered.xml
echo "Running ReportGenerator to create an html report..."
$REPORTGENERATOR \
-reports:coverage/coverage-filtered.xml \
-targetdir:coverage/report \
-verbosity:Error
if [[ "$upload_report" = true ]]
then
echo "Code coverage report uploading currently disabled."
fi