-
Notifications
You must be signed in to change notification settings - Fork 310
/
ExecuteTest.ps1
49 lines (42 loc) · 1.85 KB
/
ExecuteTest.ps1
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
$CodecovVersion = "1.12.4"
# check Codecov Token
$token = $env:CODECOV_TOKEN
if ([string]::IsNullOrEmpty($token))
{
Write-Host "Environmental Value 'CODECOV_TOKEN' is not defined." -ForegroundColor Red
exit -1
}
Write-Host "Environmental Value 'CODECOV_TOKEN' is ${token}." -ForegroundColor Green
# install coverlet
dotnet tool install --global coverlet.console > $null
dotnet add test\FaceRecognitionDotNet.Tests\FaceRecognitionDotNet.Tests.csproj package coverlet.msbuild > $null
dotnet add test\FaceRecognitionDotNet.Tests\FaceRecognitionDotNet.Tests.csproj package coverlet.collector > $null
# install codecov but it is not used from test project
dotnet add test\FaceRecognitionDotNet.Tests\FaceRecognitionDotNet.Tests.csproj package Codecov --version $CodecovVersion > $null
Write-Host "Start Test and collect Coverage." -ForegroundColor Green
# https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md
dotnet test test\FaceRecognitionDotNet.Tests\FaceRecognitionDotNet.Tests.csproj -v=normal `
/p:CollectCoverage=true `
/p:CoverletOutputFormat=opencover `
/p:Exclude="[DlibDotNet]*"
Write-Host "End Test and collect Coverage." -ForegroundColor Green
$path = (dotnet nuget locals global-packages --list).Replace('info : global-packages: ', '').Trim()
if ($path)
{
$path = (dotnet nuget locals global-packages --list).Replace('global-packages: ', '').Trim()
}
$path = Join-Path $path "codecov" | `
Join-Path -ChildPath $CodecovVersion
if ($global:IsWindows)
{
$path = Join-Path $path "tools\codecov.exe"
}
elseif ($global:IsLinux)
{
$path = Join-Path $path "tools/linux-x64/codecov"
}
elseif ($global:IsMacOS)
{
$path = Join-Path $path "tools/osx-x64/codecov"
}
& $path -f test\FaceRecognitionDotNet.Tests\coverage.opencover.xml -t $token