-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.ps1
55 lines (47 loc) · 1.84 KB
/
test.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
53
54
55
nuget install -Verbosity quiet -OutputDirectory packages -Version 4.6.519 OpenCover
nuget install -Verbosity quiet -OutputDirectory packages -Version 2.4.5.0 ReportGenerator
nuget install -Verbosity quiet -OutputDirectory packages -Version 1.0.3 CodeCov
$coverageFolder = "$PSScriptRoot\coverage"
Remove-Item $coverageFolder -force -recurse -ErrorAction SilentlyContinue | Out-Null
New-Item $coverageFolder -type directory | Out-Null
$openCover="$PSScriptRoot\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe"
$reportGenerator="$PSScriptRoot\packages\ReportGenerator.2.4.5.0\tools\ReportGenerator.exe"
$codeCov = "$PSScriptRoot\packages\CodeCov.1.0.3\tools\codecov.exe"
Write-Host "Calculating coverage with OpenCover."
& $openCover `
-target:"c:\Program Files\dotnet\dotnet.exe" `
-targetargs:"test test\GitlabCLI.Gitlab.Test\GitLabCLI.GitLab.Test.csproj" `
-mergeoutput `
-hideskipped:File `
-output:coverage/coverage.xml `
-oldStyle `
-filter:"+[GitLabCLI*]* -[GitLabCLI.*Test*]* -[GitLabCLI.Utilities]*" `
-searchdirs:$test/bin/Debug/netcoreapp2.0 `
-returntargetcode `
-register:user | Write-Host
if ($LastExitCode -ne 0)
{
exit 1
}
& $openCover `
-target:"c:\Program Files\dotnet\dotnet.exe" `
-targetargs:"test test\GitlabCLI.Console.Test\GitLabCLI.Console.Test.csproj" `
-mergeoutput `
-hideskipped:File `
-output:coverage/coverage.xml `
-oldStyle `
-filter:"+[GitLabCLI*]* -[GitLabCLI.*Test*]* -[GitLabCLI.Utilities]*" `
-searchdirs:$test/bin/Debug/netcoreapp2.0 `
-returntargetcode `
-register:user | Write-Host
if ($LastExitCode -ne 0)
{
exit 1
}
Write-Host "Generating HTML report"
& $reportGenerator `
-reports:coverage/coverage.xml `
-targetdir:coverage `
-verbosity:Error | Write-Host
Write-Host "Uploading coverage file"
& $codecov -f "coverage/coverage.xml" -t 6372499d-9a71-4043-be5e-73a76e0b7b29