Skip to content

Update README.md

Update README.md #119

Workflow file for this run

name: "3. Code Coverage"
on:
push:
branches:
- "main"
- "feature/*"
paths-ignore:
- "**/README.md"
pull_request:
branches:
- "main"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install ReportGenerator tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Restore dependencies
run: dotnet restore
- name: Build the solution
run: dotnet build --no-restore
- name: Run tests and collect code coverage
run: dotnet test --no-build --collect:"XPlat Code Coverage"
- name: Generate code coverage report
run: reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"coverage" -reporttypes:"HtmlInline_AzurePipelines;Badges"
- name: Upload coverage report zip
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: coverage
- name: Upload coverage badge file
uses: actions/upload-artifact@v4
with:
name: code-coverage-badge
path: coverage/badge_linecoverage.svg
- name: Commit coverage badge
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Copy badge to root directory
find . -name badge_linecoverage.svg || echo "Badge not found"
cp coverage/badge_linecoverage.svg ./coverage-badge.svg
# Force add badge and commit
git add -f coverage-badge.svg
if git diff-index --cached --quiet HEAD; then
echo "No changes to commit"
else
git commit -m 'Update coverage badge'
git push --force
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print Directory Structure
uses: FiorelaCiroku/XDTesting-Print-Directory-Structure@v1.0.2