Skip to content

Commit 8898596

Browse files
authored
Merge pull request #7 from codebytes/azure-pipelines
Update azure-pipelines.yml for Azure Pipelines
2 parents b7a4aca + 1f4d1ec commit 8898596

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

azure-pipelines.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,35 @@ steps:
3636

3737
# Run all tests with "/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura" to generate the code coverage file
3838
- task: DotNetCoreCLI@2
39-
displayName: Test
39+
displayName: dotnet test
4040
inputs:
4141
command: test
42-
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true --collect:"XPlat Code Coverage"'
42+
arguments: '--configuration $(BuildConfiguration) --logger trx --collect:"XPlat Code Coverage"'
4343
projects: '$(solution)'
4444
nobuild: true
45+
publishTestResults: false
4546
continueOnError: true
4647

47-
# Generate the report using ReportGenerator (https://github.com/danielpalme/ReportGenerator)
48-
# First install the tool on the machine, then run it
49-
- script: |
50-
dotnet tool install -g dotnet-reportgenerator-globaltool
51-
reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:Cobertura
52-
displayName: Create Code coverage report
48+
- task: reportgenerator@4
49+
inputs:
50+
reports: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'
51+
targetdir: 'coveragereport'
52+
sourcedirs: '$(Build.SourcesDirectory)'
5353

54-
# Publish the code coverage result (summary and web site)
55-
# The summary allows to view the coverage percentage in the summary tab
56-
# The web site allows to view which lines are covered directly in Azure Pipeline
5754
- task: PublishCodeCoverageResults@1
5855
displayName: 'Publish code coverage'
5956
inputs:
6057
codeCoverageTool: Cobertura
61-
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
62-
pathToSources: '$(Build.SourcesDirectory)'
58+
summaryFileLocation: '$(Build.SourcesDirectory)/coveragereport/Cobertura.xml'
59+
reportDirectory: '$(Build.SourcesDirectory)/coveragereport'
6360

6461
- task: PublishTestResults@2
6562
inputs:
6663
testResultsFormat: 'VSTest'
67-
testResultsFiles: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
64+
testResultsFiles: '**/*.trx'
6865
mergeTestResults: true
6966
failTaskOnFailedTests: true
70-
67+
7168
- task: DotNetCoreCLI@2
7269
inputs:
7370
command: publish

0 commit comments

Comments
 (0)