Skip to content

Commit

Permalink
Fix SonarQube coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjs committed Jul 29, 2024
1 parent 666dc73 commit 808381b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@ jobs:
- name: dotnet test
run: dotnet test -v normal -c Release --no-build

- name: Fix JS package names
shell: pwsh
run: |
Get-ChildItem TestResults -Filter *.cobertura.xml -Name | Foreach-Object {
$projectName = $_ -replace ".{14}$"
(Get-Content TestResults/$_).replace("package name=`"main`"", "package name=`"${projectName}`"") | Set-Content TestResults/$_
}
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.8
with:
reports: TestResults/*.cobertura.xml
targetdir: TestResults/report
reporttypes: Cobertura;HtmlInline;JsonSummary;MarkdownSummaryGithub
reporttypes: Cobertura;HtmlInline;JsonSummary;MarkdownSummaryGithub;SonarQube

- name: Check coverage thresholds
shell: pwsh
Expand Down
2 changes: 1 addition & 1 deletion ci-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Get-ChildItem TestResults -Filter *.cobertura.xml -Name | Foreach-Object {
$projectName = $_ -replace ".{14}$"
(Get-Content TestResults/$_).replace("package name=`"main`"", "package name=`"${projectName}`"") | Set-Content TestResults/$_
}
reportgenerator -reports:"TestResults/*.cobertura.xml" -targetdir:TestResults/report -reporttypes:"Cobertura;HtmlInline;JsonSummary;MarkdownSummaryGithub" -verbosity:Warning
reportgenerator -reports:"TestResults/*.cobertura.xml" -targetdir:TestResults/report -reporttypes:"Cobertura;HtmlInline;JsonSummary;MarkdownSummaryGithub;SonarQube" -verbosity:Warning

# Output coverage information
$coverage = Get-Content -Raw TestResults/report/Summary.json | ConvertFrom-Json
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ sonar.test.inclusions=**/*-test/**/*.cs,**/*.test.*
# Exclude test subdirectories and file patterns from source scope
# Exclude configuration files (json,props)
sonar.exclusions=**/*-test/**/*.cs,**/*.test.*,**/*.json,**/*.props

# Coverage properties
sonar.coverageReportPaths=TestResults/report/SonarQube.xml

0 comments on commit 808381b

Please sign in to comment.