forked from takuya-takeuchi/FaceRecognitionDotNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExecuteTest.ps1
52 lines (44 loc) · 1.75 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
50
51
52
$CodecovVersion = "1.7.1"
$CoverletVersion = "1.4.1"
# 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
$Current = Get-Location
$CoverageDir = Join-Path $Current CoverageResults
if (!(Test-Path "$CoverageDir"))
{
New-Item "$CoverageDir" -ItemType Directory > $null
}
# install coverlet
dotnet tool install --global coverlet.console --version $CoverletVersion > $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 `
/p:CollectCoverage=true `
/p:CoverletOutputFormat=opencover `
/p:Exclude="[DlibDotNet]*" `
-c Release
Write-Host "End Test and collect Coverage." -ForegroundColor Green
$path = (dotnet nuget locals global-packages --list).Replace('info : 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