I'm trying to setup a pipeline that runs sonarscanner, unit tests with code coverage. I can't figure out why it is not working. I'm getting no errors but in sonarcloud is saying 0 errors and 0% coverage.
Coverlet open cover is creating XML file that is actually confirming that there is a percentage covered.
this is my repository: https://github.com/Kwebbel-project/tweet-service/tree/development
This is how my pipeline looks
name: Development
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]
jobs:
Analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install Sonar global tool
run: dotnet tool install --global dotnet-sonarscanner
- name: Begin sonar scan
run: |
dotnet sonarscanner begin /k:"Kwebbel-project_tweet-service" /o:"kwebbel-project" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login=${{ secrets.SONAR_TOKEN }} /d:sonar.verbose=true
- name: Build and run unit tests
run: |
dotnet restore
dotnet build
dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -o="coverage.xml"
- name: End Sonar scan
run: dotnet sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }}