From 808a55e809211180e0c0d266bd3120ee20818dbb Mon Sep 17 00:00:00 2001 From: Kyle Laverty Date: Wed, 22 May 2024 10:17:45 -0400 Subject: [PATCH] Try to get github action test report working correctly --- .github/workflows/build.yml | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 994bc5a..28f2305 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,21 +58,12 @@ jobs: run: dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore - name: Test ๐Ÿงช - run: dotnet test --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --verbosity normal --logger trx - /p:CollectCoverage=true - /p:CoverletOutput=${{ github.workspace }}/coverage.info - /p:CoverletOutputFormat=lcov + run: dotnet test --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --verbosity normal --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat="json,lcov,cobertura";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' test/learning-fast-endpoints-tests -- RunConfiguration.CollectSourceInformation=true - # Upload the test coverage report - - name : Upload Test Coverage Report - uses: actions/upload-artifact@v4 - with: - name: dotent-test-coverage - path: ${{ github.workspace }}/coverage.info - - - name: Publish coverage report to coveralls.io - uses: coverallsapp/github-action@v2.3.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ github.workspace }}/coverage.info - format: 'lcov' + - name: Code Coverage Report ๐Ÿ“ + run: | + dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.1.23 + reportgenerator -reports:${{github.workspace}}/coverage.cobertura.xml -targetdir:${{github.workspace}}/report -reporttypes:MarkdownSummaryGithub "-filefilters:-*.g.cs;-*.gen.cs" -verbosity:Warning + sed -i 's/# Summary/## ๐Ÿ“ Code Coverage/g' ${{github.workspace}}/report/SummaryGithub.md + sed -i 's/## Coverage/### Code Coverage details/g' ${{github.workspace}}/report/SummaryGithub.md + cat ${{github.workspace}}/report/*.md >> $GITHUB_STEP_SUMMARY