Skip to content

Development

Development #11

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: write # needed to comment on PRs
issues: write # comments use the issues API under the hood
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore
run: dotnet restore AppConfigCli.sln
- name: Build
run: dotnet build AppConfigCli.sln --configuration Release --nologo --verbosity minimal
- name: Test with coverage
run: |
dotnet test AppConfigCli.sln \
--configuration Release \
--nologo --verbosity minimal \
--collect:"XPlat Code Coverage"
- name: Generate coverage report
uses: danielpalme/ReportGenerator-GitHub-Action@v5.3.9
with:
reports: 'tests/**/TestResults/*/coverage.cobertura.xml'
targetdir: 'coveragereport'
reporttypes: 'HtmlInline;MarkdownSummary;Cobertura'
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coveragereport
- name: Add coverage to job summary
run: |
echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
if [ -f coveragereport/Summary.md ]; then
cat coveragereport/Summary.md >> $GITHUB_STEP_SUMMARY
else
echo "No coverage summary found." >> $GITHUB_STEP_SUMMARY
fi
- name: Comment coverage on PR
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false }}
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: coveragereport/Summary.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}