-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcoverage.sh
52 lines (38 loc) · 1.32 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
#!/bin/bash
set -e
# Install OpenCover and ReportGenerator, and save the path to their executables.
nuget install -Verbosity quiet -OutputDirectory packages -Version 4.6.519 OpenCover
nuget install -Verbosity quiet -OutputDirectory packages -Version 2.4.5.0 ReportGenerator
OPENCOVER=$PWD/packages/OpenCover.4.6.519/tools/OpenCover.Console.exe
REPORTGENERATOR=$PWD/packages/ReportGenerator.2.4.5.0/tools/ReportGenerator.exe
CONFIG=Release
# Arguments to use for the build
DOTNET_BUILD_ARGS="-c $CONFIG"
# Arguments to use for the test
DOTNET_TEST_ARGS="$DOTNET_BUILD_ARGS"
echo CLI args: $DOTNET_BUILD_ARGS
echo Restoring
dotnet restore
echo Building
dotnet build $DOTNET_BUILD_ARGS
echo Testing
coverage=./coverage
rm -rf $coverage
mkdir $coverage
dotnet test -f netcoreapp1.1 $DOTNET_TEST_ARGS test/GB2260.Test/GB2260.Test.csproj
echo "Calculating coverage with OpenCover"
$OPENCOVER \
-target:"c:\Program Files\dotnet\dotnet.exe" \
-targetargs:"test -f netcoreapp1.1 $DOTNET_TEST_ARGS test/GB2260.Test/GB2260.Test.csproj" \
-mergeoutput \
-hideskipped:File \
-output:$coverage/coverage.xml \
-oldStyle \
-filter:"+[*]*" \
-searchdirs:$testdir/bin/$CONFIG/netcoreapp1.1 \
-register:user
echo "Generating HTML report"
$REPORTGENERATOR \
-reports:$coverage/coverage.xml \
-targetdir:$coverage \
-verbosity:Error