Skip to content

Commit 33b6df9

Browse files
committed
Publish build logs and use the VSTS test reporter
1 parent a4c7603 commit 33b6df9

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

azure-pipelines.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ jobs:
3838
solution: '$(BuildSolution)'
3939
platform: '$(BuildPlatform)'
4040
configuration: '$(BuildConfiguration)'
41+
msbuildArgs: '/bl'
4142

4243
- task: PowerShell@2
4344
displayName: Run Tests
4445
inputs:
4546
workingDirectory: '$(Build.SourcesDirectory)/build'
4647
filePath: build/opencover-report.ps1
47-
arguments: '$(_debugArg) -NoBuild -NoReport'
48+
arguments: '$(_debugArg) -NoBuild -NoReport -Azure'
49+
50+
- task: PublishBuildArtifacts@1
51+
displayName: Publish build logs
52+
inputs:
53+
pathtoPublish: msbuild.binlog
54+
condition: failed()

build/opencover-report.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ param (
22
[switch]$Debug,
33
[switch]$NoBuild,
44
[switch]$NoReport,
5-
[switch]$AppVeyor
5+
[switch]$AppVeyor,
6+
[switch]$Azure
67
)
78

89
If (-not $NoBuild) {
@@ -51,6 +52,9 @@ $register_mode = 'user'
5152
If ($AppVeyor) {
5253
$AppVeyorArg = '-appveyor'
5354
$register_mode = 'Path32'
55+
} ElseIf ($Azure) {
56+
$AppVeyorArg = '-vsts'
57+
$register_mode = 'Path32'
5458
}
5559

5660
&$opencover_console `
@@ -65,7 +69,7 @@ If ($AppVeyor) {
6569
-target:"$xunit_runner_console_net452" `
6670
-targetargs:"$target_dll -noshadow $AppVeyorArg"
6771

68-
If ($AppVeyor -and -not $?) {
72+
If (($AppVeyor -or $Azure) -and -not $?) {
6973
$host.UI.WriteErrorLine('Build failed; coverage analysis aborted.')
7074
Exit $LASTEXITCODE
7175
}
@@ -83,7 +87,7 @@ If ($AppVeyor -and -not $?) {
8387
-target:"$xunit_runner_console_net46" `
8488
-targetargs:"$target_dll_csharp7 -noshadow $AppVeyorArg"
8589

86-
If ($AppVeyor -and -not $?) {
90+
If (($AppVeyor -or $Azure) -and -not $?) {
8791
$host.UI.WriteErrorLine('Build failed; coverage analysis aborted.')
8892
Exit $LASTEXITCODE
8993
}
@@ -101,7 +105,7 @@ If ($AppVeyor -and -not $?) {
101105
-target:"$xunit_runner_console_net472" `
102106
-targetargs:"$target_dll_csharp8 -noshadow $AppVeyorArg"
103107

104-
If ($AppVeyor -and -not $?) {
108+
If (($AppVeyor -or $Azure) -and -not $?) {
105109
$host.UI.WriteErrorLine('Build failed; coverage analysis aborted.')
106110
Exit $LASTEXITCODE
107111
}

0 commit comments

Comments
 (0)