Hello there we are using Github with Github Actions to Analyze a C# .NET project. The sonar scanner seems to be picking up the opencover coverage report, but we are still seeing 0% in SonarCloud.
For reference, here is how we are scanning the project in Github Actions.
- name: Test with the dotnet CLI
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"****" /o:"****" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths="./AirTrafficControllTests/coverage.opencover.xml" /d:sonar.host.url="https://sonarcloud.io"
dotnet build AirTrafficControll.sln
dotnet test AirTrafficControll.sln /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
env:
ASPNETCORE_ENVIRONMENT: Development
ConnectionStrings__DefaultConnection: server=localhost;port=3306;userid=****;password=****;database=****;
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
As I mentioned, it seems the report is being picked up as detailed by the sonar logs.
INFO: Sensor C# [csharp] (done) | time=428ms
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report /home/runner/work/cps420-project-wolf-pack-minus-zach/cps420-project-wolf-pack-minus-zach/././AirTrafficControllTests/coverage.opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: /home/runner/work/cps420-project-wolf-pack-minus-zach/cps420-project-wolf-pack-minus-zach/././AirTrafficControllTests/coverage.opencover.xml
INFO: Coverage Report Statistics: 17 files, 17 main files, 17 main files with coverage, 0 test files, 0 project excluded files, 0 other language files.
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=299ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=3ms
But sonar cloud still shows coverage at 0.
I hope I have provided enough information. If anything else is needed, please let me know.