77name : $[format('{0}', variables['buildName'])]
88
99pool :
10- vmImage : ' windows-2019 '
10+ vmImage : ' windows-2022 '
1111
1212trigger :
1313 branches :
@@ -19,9 +19,7 @@ trigger:
1919
2020 paths :
2121 exclude :
22- - README.md
23- - Images/*
24- - Samples/*
22+ - Docs/*
2523
2624variables :
2725 solution : ' HttpClient.Caching.sln'
@@ -69,31 +67,37 @@ steps:
6967 FailOnWarning : false
7068 DisableTelemetry : false'
7169
72-
7370- task : NuGetToolInstaller@0
74- displayName : ' Use NuGet 5 .x'
71+ displayName : ' Use NuGet 6 .x'
7572 inputs :
76- versionSpec : 5 .x
73+ versionSpec : 6 .x
7774
78- - task : NuGetCommand @2
75+ - task : DotNetCoreCLI @2
7976 displayName : ' NuGet restore'
8077 inputs :
81- restoreSolution : ' $(solution)'
78+ command : restore
79+ projects : ' $(solution)'
8280
83- - task : VSBuild@1
81+ - task : DotNetCoreCLI@2
8482 displayName : ' Build solution'
8583 inputs :
86- solution : ' $(solution)'
87- msbuildArgs : ' '
88- platform : ' $(BuildPlatform)'
89- configuration : ' $(BuildConfiguration)'
90-
84+ projects : ' $(solution)'
85+ arguments : ' --no-restore --configuration $(buildConfiguration)'
86+
9187- task : DotNetCoreCLI@2
9288 displayName : ' Run UnitTests'
9389 inputs :
9490 command : test
9591 projects : ' **/*.Tests.csproj'
96- arguments : ' --no-restore --no-build --configuration $(buildConfiguration)'
92+ arguments : ' --no-restore --no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:Exclude="[Microsoft*]*%2C[Mono*]*%2C[xunit*]*%2C[*.Testdata]*" /p:CoverletOutput=UnitTests.coverage.cobertura.xml /p:MergeWith=$(Build.SourcesDirectory)/Tests/CoverletOutput/coverage.json /p:CoverletOutputFormat=cobertura'
93+
94+ - task : Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
95+ displayName : ' Create Code Coverage Report'
96+ inputs :
97+ reports : ' $(Build.SourcesDirectory)/Tests/**/*.coverage.cobertura*.xml'
98+ targetdir : ' $(Build.SourcesDirectory)/CodeCoverage'
99+ reporttypes : ' Cobertura'
100+ assemblyfilters : ' -xunit*'
97101
98102- task : DotNetCoreCLI@2
99103 displayName : ' Pack HttpClient.Caching'
@@ -113,6 +117,13 @@ steps:
113117 **\bin\*.nupkg
114118
115119 TargetFolder : ' $(Build.ArtifactStagingDirectory)'
120+
121+ - task : PublishCodeCoverageResults@1
122+ displayName : ' Publish code coverage'
123+ inputs :
124+ codeCoverageTool : Cobertura
125+ summaryFileLocation : ' $(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
126+ reportDirectory : ' $(Build.SourcesDirectory)/CodeCoverage'
116127
117128- task : PublishBuildArtifacts@1
118129 displayName : ' Publish Artifact: drop'
0 commit comments