diff --git a/.github/scripts/coverage.ps1 b/.github/scripts/coverage.ps1 index ceb57465..226331d0 100644 --- a/.github/scripts/coverage.ps1 +++ b/.github/scripts/coverage.ps1 @@ -2,23 +2,24 @@ $projectRoot = (Resolve-Path "$PSScriptRoot\..\..") Push-Location $projectRoot try { - Remove-Item -Path "SubathonManager.Tests\TestResults\*" -Recurse -Force - dotnet test --collect:"XPlat Code Coverage" ` - /p:Exclude="[SubathonManager.Data.Migrations]*" ` - /p:CollectCoverage=true ` - /p:CoverletOutputFormat=cobertura ` - /p:ExcludeByFile="**/*.g.cs" + Remove-Item -Path "SubathonManager.Tests\TestResults\*" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "coverage-local" -Recurse -Force -ErrorAction SilentlyContinue + dotnet test SubathonManager.Tests\SubathonManager.Tests.csproj ` + --results-directory coverage-local ` + --coverage ` + --coverage-output-format cobertura ` + --coverage-output coverage.cobertura.xml reportgenerator ` - -reports:"**\coverage.cobertura.xml" ` + -reports:"**\*.cobertura.xml" ` -targetdir:"coverage-report" ` -reporttypes:Html ` -classfilters:"+*;-SubathonManager.Data.Migrations.*" ` -filefilters:"-**/*.g.cs" - + Invoke-Item coverage-report/index.html } finally { Pop-Location -} \ No newline at end of file +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8269aea1..162e5234 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,15 +96,15 @@ jobs: run: | dotnet test SubathonManager.Tests/SubathonManager.Tests.csproj \ --configuration Release \ - --logger "console;verbosity=detailed" \ - --logger "trx;LogFileName=test-results.trx" \ - --blame \ - --blame-crash \ - --blame-hang \ - --blame-hang-timeout 5m \ - --collect:"XPlat Code Coverage" \ --results-directory ./coverage \ - -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile="**/Migrations/**;**/*.g.cs;**/SubathonManager.UI/**" + -p:TestingPlatformShowTestsFailure=true \ + --report-trx \ + --report-trx-filename test-results.trx \ + --crashdump \ + --hangdump \ + --hangdump-timeout 5m \ + --coverage \ + --coverage-output-format cobertura - name: Show blame / crash diagnostics if: always() @@ -132,15 +132,17 @@ jobs: - name: List raw coverage files if: always() shell: bash - run: ls -la coverage/**/coverage.cobertura.xml || true - + run: find . -name '*.cobertura.xml' -print || true + - name: Merge coverage reports if: always() uses: danielpalme/ReportGenerator-GitHub-Action@5 with: - reports: coverage/**/coverage.cobertura.xml + reports: '**/*.cobertura.xml' targetdir: coverage-merged reporttypes: Cobertura + assemblyfilters: '-SubathonManager.UI' + filefilters: '-**/Migrations/**;-**/*.g.cs' - name: Code Coverage Summary Report if: always() diff --git a/SubathonManager.Tests/SubathonManager.Tests.csproj b/SubathonManager.Tests/SubathonManager.Tests.csproj index 4b693088..38c1b2a3 100644 --- a/SubathonManager.Tests/SubathonManager.Tests.csproj +++ b/SubathonManager.Tests/SubathonManager.Tests.csproj @@ -1,7 +1,6 @@ - - + - net10.0 + net10.0 enable enable false @@ -12,23 +11,21 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + + + + + - - + - - @@ -36,5 +33,4 @@ - - \ No newline at end of file + diff --git a/SubathonManager.UI/SubathonManager.UI.csproj b/SubathonManager.UI/SubathonManager.UI.csproj index d2bf4f4b..e7cc2410 100644 --- a/SubathonManager.UI/SubathonManager.UI.csproj +++ b/SubathonManager.UI/SubathonManager.UI.csproj @@ -53,7 +53,7 @@ - + diff --git a/global.json b/global.json index a11f48e1..af1e4b07 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "10.0.0", "rollForward": "latestMajor", "allowPrerelease": true + }, + "test": { + "runner": "Microsoft.Testing.Platform" } -} \ No newline at end of file +}