From 26ca703d4aff80b08271b6bca90f8f4afb230ad7 Mon Sep 17 00:00:00 2001 From: Jasmin Oster Date: Fri, 27 Oct 2023 14:05:08 +0200 Subject: [PATCH] Write test output and coverage to GH actions --- .github/workflows/test.yml | 29 ++++++++++++++++++++++++++++- .gitignore | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 540f80b..a53e076 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,4 +16,31 @@ jobs: cache: true cache-dependency-path: src/**/packages.lock.json - run: dotnet restore --locked-mode - - run: dotnet test + - name: Run tests with coverage + run: dotnet test /p:CollectCoverage=true --logger trx --results-directory "TestResults" + - name: Upload dotnet test results + uses: actions/upload-artifact@v3 + with: + name: dotnet-results + path: TestResults + if: ${{ always() }} + + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage/**/coverage.cobertura.xml + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: true + indicators: true + output: both + thresholds: '60 80' + + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + recreate: true + path: code-coverage-results.md diff --git a/.gitignore b/.gitignore index 99e59ac..9a3ee1f 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,4 @@ fabric.properties # End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudiocode,intellij+all *.DotSettings.user +TestResults/