diff --git a/.github/workflows/dotnet-build-and-test.yml b/.github/workflows/dotnet-build-and-test.yml index 1923d79..bc36d3e 100644 --- a/.github/workflows/dotnet-build-and-test.yml +++ b/.github/workflows/dotnet-build-and-test.yml @@ -27,107 +27,55 @@ jobs: run: dotnet build Framework-All.sln --configuration Release --no-restore # Framework Tests - - name: Run tests for DavidBerry.Framework + - name: Run tests run: > - dotnet test DavidBerry.Framework/DavidBerry.Framework.Tests/DavidBerry.Framework.Tests.csproj \ + dotnet test Framework-All.sln \ --configuration Release \ --no-build \ - --logger "trx;LogFileName=DavidBerry.Framework.Tests.trx" \ - --results-directory TestResults/Framework \ + --logger "trx;LogFilePrefix=TestResults" \ + --results-directory TestResults/ \ --collect:"XPlat Code Coverage" \ /p:CollectCoverage=true \ - /p:CoverletOutput=TestResults/coverage/ \ + /p:CoverletOutput=TestResults/ \ /p:CoverletOutputFormat=cobertura - - name: Upload Framework test results artifact + - name: Upload test results artifact uses: actions/upload-artifact@v4 with: - name: framework-test-results - path: TestResults/Framework/**.trx + name: test-results + path: TestResults/**.trx - - name: Upload Framework code coverage report - uses: actions/upload-artifact@v4 - with: - name: framework-code-coverage-report - path: TestResults/Framework/**/coverage.cobertura.xml - - - name: Publish Framework Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - files: TestResults/Framework/**.trx - check_name: "Framework Test Results" - comment_title: "Framework Test Results" - - # API Util Tests - - name: Run tests for DavidBerry.Framework.ApiUtil - run: > - dotnet test DavidBerry.Framework.ApiUtil/DavidBerry.Framework.ApiUtil.Tests/DavidBerry.Framework.ApiUtil.Tests.csproj \ - --configuration Release \ - --no-build \ - --logger "trx;LogFileName=DavidBerry.Framework.ApiUtil.Tests.trx" \ - --results-directory TestResults/ApiUtil \ - --collect:"XPlat Code Coverage" \ - /p:CollectCoverage=true \ - /p:CoverletOutput=TestResults/coverage/ \ - /p:CoverletOutputFormat=cobertura - - - name: Upload Framework.ApiUtil test results artifact - uses: actions/upload-artifact@v4 - with: - name: framework-apiutil-test-results - path: TestResults/ApiUtil/**.trx - - - name: Upload Framework.ApiUtil code coverage report - uses: actions/upload-artifact@v4 - with: - name: framework-apiutil-code-coverage-report - path: TestResults/ApiUtil/**/coverage.cobertura.xml - - - name: Publish ApiUtil Test Results + - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v2 with: - files: TestResults/ApiUtil/**.trx - check_name: "ApiUtil Test Results" - comment_title: "ApiUtil Test Results" + files: TestResults/**.trx + check_name: "Test Results" + comment_title: "Test Results" - # Spatial Tests - - name: Run tests for DavidBerry.Framework.Spatial - run: > - dotnet test DavidBerry.Framework.Spatial/DavidBerry.Framework.Spatial.Tests/DavidBerry.Framework.Spatial.Tests.csproj \ - --configuration Release \ - --no-build \ - --logger "trx;LogFileName=DavidBerry.Framework.Spatial.Tests.trx" \ - --results-directory TestResults/Spatial \ - --collect:"XPlat Code Coverage" \ - /p:CollectCoverage=true \ - /p:CoverletOutput=TestResults/coverage/ \ - /p:CoverletOutputFormat=cobertura - - name: Upload Framework.Spatial test results artifact - uses: actions/upload-artifact@v4 + - name: Combine Coverage Reports # This is because one report is produced per project, and we want one result for all of them. + uses: danielpalme/ReportGenerator-GitHub-Action@5.4.17 with: - name: framework-spatial-test-results - path: TestResults/Spatial/**.trx - - - name: Upload Framework.Spatial code coverage report + reports: "TestResults/**/*.cobertura.xml" # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported. + targetdir: "${{ github.workspace }}" # REQUIRED # The directory where the generated report should be saved. + reporttypes: "Cobertura" # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MarkdownSummaryGithub, MarkdownDeltaSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, TextDeltaSummary, Xml, XmlSummary + verbosity: "Info" # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off + title: "Code Coverage Report" # Optional title. + tag: "${{ github.run_number }}_${{ github.run_id }}" # Optional tag or build version. + customSettings: "" # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings. + toolpath: "reportgeneratortool" # Default directory for installing the dotnet tool. + + - name: Upload code coverage report uses: actions/upload-artifact@v4 with: - name: framework-spatial-code-coverage-report - path: TestResults/Spatial/**/coverage.cobertura.xml - - - name: Publish Spatial Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - files: TestResults/Spatial/**.trx - check_name: "Spatial Test Results" - comment_title: "Spatial Test Results" + name: framework-code-coverage-report + path: ${{ github.workspace }}/Cobertura.xml # Publish Code Coverage Summaries - - name: Publish code coverage summary uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: TestResults/Framework/**/coverage.cobertura.xml,TestResults/ApiUtil/**/coverage.cobertura.xml,TestResults/Spatial/**/coverage.cobertura.xml + filename: "Cobertura.xml" badge: true fail_below_min: false format: markdown