Skip to content

another sample of use to README file #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ Also includes test results.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

## Include code coverage with [Coverlet](https://github.com/coverlet-coverage/coverlet)

To `MyProject.Test` add a Nuget packages `coverlet.msbuild` and `coverlet.collector`.

Here is a full example of Github Action yml file where code coverage report is generated and uploaded to SonarQube.io.

``` yaml
name: Sonarqube Analyze
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: SonarScanner for .NET Core with pull request decoration support
uses: highbyte/sonarscan-dotnet@1.0
with:
sonarProjectKey: your_projectkey
sonarProjectName: your_projectname
sonarOrganization: your_organization
dotnetBuildArguments: ./src/MyProject/MyProject.csproj
dotnetTestArguments: ./src/MyProject.Test/MyProject.Test.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
sonarBeginArguments: /d:sonar.verbose="true" /d:sonar.language="cs" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
```

## Build subfolder src, and include code coverage
Also includes test results.

Expand Down