44# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
55
66trigger :
7- - master
8-
9- pool :
10- vmImage : ' ubuntu-latest'
11-
12- variables :
13- solution : ' **/*.sln'
14- buildPlatform : ' Any CPU'
15- buildConfiguration : ' Release'
16-
17- steps :
18-
19- - task : UseDotNet@2
20- displayName : ' Install .net core 3.1'
21- inputs :
22- packageType : ' sdk'
23- version : ' 3.1.100'
24-
25- - task : DotNetCoreCLI@2
26- displayName : ' .NET Core - Restore packages'
27- inputs :
28- command : ' restore'
29- projects : ' ./src'
30- feedsToUse : ' select'
31-
32- - task : DotNetCoreCLI@2
33- displayName : ' .NET Core - Build'
34- inputs :
35- command : ' build'
36- projects : ' ./src'
37- arguments : ' -c $(buildConfiguration) --no-restore'
38-
39- # Run all tests with "/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura" to generate the code coverage file
40- - task : DotNetCoreCLI@2
41- displayName : ' .NET Core - Tests'
42- inputs :
43- command : test
44- arguments : ' --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
45- projects : ' tests/**/*.csproj'
46- nobuild : true
47-
48- - task : Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
49- displayName : ReportGenerator
50- inputs :
51- reports : ' $(Build.SourcesDirectory)/tests/**/coverage.cobertura.xml'
52- targetdir : ' $(Build.SourcesDirectory)/CodeCoverage'
53- reporttypes : ' HtmlInline_AzurePipelines;Cobertura;Badges'
54- assemblyfilters : ' -xunit*'
55-
56- # Publish the code coverage result (summary and web site)
57- # The summary allows to view the coverage percentage in the summary tab
58- # The web site allows to view which lines are covered directly in Azure Pipeline
59- - task : PublishCodeCoverageResults@1
60- displayName : ' Publish code coverage'
61- inputs :
62- codeCoverageTool : Cobertura
63- summaryFileLocation : ' $(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
64- reportDirectory : ' $(Build.SourcesDirectory)/CodeCoverage'
65-
66-
67-
7+ - master
8+
9+ pool :
10+ vmImage : ' ubuntu-latest'
11+
12+ variables :
13+ solution : ' **/*.sln'
14+ buildPlatform : ' Any CPU'
15+ buildConfiguration : ' Release'
16+
17+ steps :
18+
19+ - task : UseDotNet@2
20+ displayName : ' Install .net core 3.1'
21+ inputs :
22+ packageType : ' sdk'
23+ version : ' 3.1.100'
24+
25+ - task : DotNetCoreCLI@2
26+ displayName : ' .NET Core - Restore packages'
27+ inputs :
28+ command : ' restore'
29+ projects : ' ./src'
30+ feedsToUse : ' select'
31+
32+ - task : DotNetCoreCLI@2
33+ displayName : ' .NET Core - Build'
34+ inputs :
35+ command : ' build'
36+ projects : ' ./src'
37+ arguments : ' -c $(buildConfiguration) --no-restore'
38+
39+ # Run all tests with "/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura" to generate the code coverage file
40+ - task : DotNetCoreCLI@2
41+ displayName : ' .NET Core - Tests'
42+ inputs :
43+ command : test
44+ arguments : ' --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
45+ projects : ' tests/**/*.csproj'
46+ nobuild : true
47+
48+ - task : Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
49+ displayName : ReportGenerator
50+ inputs :
51+ reports : ' $(Build.SourcesDirectory)/tests/**/coverage.cobertura.xml'
52+ targetdir : ' $(Build.SourcesDirectory)/CodeCoverage'
53+ reporttypes : ' HtmlInline_AzurePipelines;Cobertura;Badges'
54+ assemblyfilters : ' -xunit*'
55+
56+ # Publish the code coverage result (summary and web site)
57+ # The summary allows to view the coverage percentage in the summary tab
58+ # The web site allows to view which lines are covered directly in Azure Pipeline
59+ - task : PublishCodeCoverageResults@1
60+ displayName : ' Publish code coverage'
61+ inputs :
62+ codeCoverageTool : Cobertura
63+ summaryFileLocation : ' $(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
64+ reportDirectory : ' $(Build.SourcesDirectory)/CodeCoverage'
65+
66+
0 commit comments