fix coverage settings #591
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- test | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Test Solution | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
$ErrorActionPreference = 'Stop'; | |
dotnet build-server shutdown; | |
dotnet test .\clio.tests\clio.tests.csproj --collect:"XPlat Code Coverage"; | |
$report = Get-ChildItem -Path .\clio.tests\TestResults -Recurse -Filter coverage.opencover.xml; | |
Copy-Item $report.FullName -Destination .\TestResults\coverage.opencover.xml -Force; | |
- name: Publish UnitTest Results | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
$ErrorActionPreference = 'Stop'; | |
C:\Tools\reportgenerator.exe -reports:TestResults\coverage.opencover.xml ` | |
-targetdir:"D:\Projects\inetpub\wwwroot\Docs\clio\UnitTests\Html" ` | |
-historydir:"D:\Projects\inetpub\wwwroot\Docs\clio\UnitTests\History" ` | |
-assemblyfilters:"+Clio;-Terrasoft.*" ` | |
-title:"Clio Unit Tests" ` | |
-reporttypes:"Html;SonarQube;MarkdownSummaryGithub;Badges"; | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_URL: ${{ secrets.SONAR_URL }} | |
shell: powershell | |
run: | | |
dotnet sonarscanner begin /k:"clio" /d:sonar.host.url="${{ secrets.SONAR_URL }}" ` | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" ` | |
/d:sonar.cs.opencover.reportsPaths="TestResults\coverage.opencover.xml"; | |
dotnet build .\clio\clio.csproj -c Release --no-incremental; | |
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
dotnet build-server shutdown; |