Create coverage-report.yml #24
Workflow file for this run
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 with Markdown Report | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build-and-report: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Run tests | |
run: dotnet test --no-restore --no-build --collect:"XPlat Code Coverage" | |
- name: ReportGenerator | |
uses: danielpalme/[email protected] | |
with: | |
reports: coverage.cobertura.xml | |
targetdir: ${{github.workspace}}/report | |
reporttypes: MarkdownSummary | |
- name: Upload reports | |
uses: actions/upload-artifact@v2 | |
if: ${{always()}} | |
with: | |
name: 'Code Coverage' | |
path: | | |
${{github.workspace}}/report | |
- name: Comments on PR with coverage report results | |
uses: marocchino/sticky-pull-request-comment@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
recreate: true | |
header: Coverage Report | |
path: ${{github.workspace}}/report/SummaryGithub.md |