Skip to content

Commit

Permalink
Merge branch 'fix/ci-test-coverage' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel127 committed Apr 10, 2020
2 parents 199b1c7 + 1032c3c commit 4f0d103
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 10 deletions.
29 changes: 24 additions & 5 deletions .azure/workflows/azure-ci-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ steps:
scannerMode: 'MSBuild'
projectKey: 'ef-unit-of-work'
projectName: 'EF-Unit-Of-Work'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/coverage/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx
# Build solution
- task: DotNetCoreCLI@2
Expand All @@ -51,15 +55,30 @@ steps:
- task: DotNetCoreCLI@2
displayName: 'Execute tests'
inputs:
command: 'test'
projects: '**/*.csproj'
publishTestResults: true
arguments: '--collect "Code Coverage"'
command: test
nobuild: true
arguments: --logger trx -c $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover%2ccobertura /p:CoverletOutput=$(Agent.TempDirectory)/coverage/ --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true

- task: DotNetCoreCLI@2
displayName: 'Install ReportGenerator tool'
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool

- script: ./reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"HtmlInline_AzurePipelines;Cobertura"
displayName: 'Create reports'

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml

# SonarCloud analyze and publish results
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud analysis'
- task: SonarCloudPublish@1
displayName: 'Publish results on build summary'
displayName: 'Publish results on SonarCloud'
inputs:
pollingTimeoutSec: '300'
28 changes: 24 additions & 4 deletions .azure/workflows/azure-ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ steps:

# SonarCloud Prepare Analysis
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis configuration'
inputs:
SonarCloud: 'SonarCloud Daniel127'
organization: 'daniel127'
scannerMode: 'MSBuild'
projectKey: 'ef-unit-of-work'
projectName: 'EF-Unit-Of-Work'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/coverage/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx
# Build solution
- task: DotNetCoreCLI@2
Expand All @@ -54,10 +59,25 @@ steps:
- task: DotNetCoreCLI@2
displayName: 'Execute tests'
inputs:
command: 'test'
projects: '**/*.csproj'
publishTestResults: true
arguments: '--collect "Code Coverage"'
command: test
nobuild: true
arguments: --logger trx -c $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover%2ccobertura /p:CoverletOutput=$(Agent.TempDirectory)/coverage/ --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true

- task: DotNetCoreCLI@2
displayName: 'Install ReportGenerator tool'
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool

- script: ./reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"HtmlInline_AzurePipelines;Cobertura"
displayName: 'Create reports'

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml

# SonarCloud analyze and publish results
- task: SonarCloudAnalyze@1
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,5 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb
.vscode/
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.2.0" />
<PackageReference Include="coverlet.msbuild" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 4f0d103

Please sign in to comment.