forked from bitwarden/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage.sh
executable file
·53 lines (43 loc) · 1.05 KB
/
coverage.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
#!/bin/bash
# Set defaults if no values supplied
CONFIGURATION="Release"
OUTPUT="CoverageOutput"
REPORT_TYPE="lcov"
# Read in arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--configuration)
CONFIGURATION="$2"
shift
shift
;;
-o|--output)
OUTPUT="$2"
shift
shift
;;
-rt|--reportType)
REPORT_TYPE="$2"
shift
shift
;;
*)
shift
;;
esac
done
echo "CONFIGURATION = ${CONFIGURATION}"
echo "OUTPUT = ${OUTPUT}"
echo "REPORT_TYPE = ${REPORT_TYPE}"
echo "Collectiong Code Coverage"
# Install tools
dotnet tool restore
# Print Environment
dotnet --version
if [[ -d $OUTPUT ]]; then
echo "Cleaning output location"
rm -rf $OUTPUT
fi
dotnet test "./bitwarden.tests.sln" /p:CoverletOutputFormatter="cobertura" --collect:"XPlat Code Coverage" --results-directory:"$OUTPUT" -c $CONFIGURATION
dotnet tool run reportgenerator -reports:$OUTPUT/**/*.cobertura.xml -targetdir:$OUTPUT -reporttype:"$REPORT_TYPE"