I've been struggling with this issue for a few days now and I can't seem to pinpoint what I'm doing wrong.
I've been trying to analyze a c# project that is build with travis CI and analyzed in sonarcloud.
I've set up travis (see: https://travis-ci.org/ShiveringSquirrel/heroes-app-webapi) to build and it seems to work fine.
Configuration
See .travis.yml
language: csharp
solution: heroes-app-webapi.sln
dist: trusty
sudo: required
mono:
- latest
install:
- nuget restore heroes-app-webapi.sln
- nuget install NUnit.Console -Version 3.9.0 -OutputDirectory testrunner
addons:
sonarcloud:
organization: "shiveringsquirrel-github"
token:
secure: $SONAR_TOKEN
script:
- msbuild /p:Configuration=Release /target:rebuild heroes-app-webapi.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./heroes-app-webapi.Tests/bin/Release/heroes-app-webapi.Tests.dll
- sonar-scanner -Dsonar.projectVersion=1.$TRAVIS_BUILD_NUMBER
cache:
directories:
- '$HOME/.sonar/cache'
git:
clone: true
quiet: false
depth: false
submodules: true
# blocklist
branches:
except:
- legacy
- experimental
# safelist
branches:
only:
- master
- stable
sonar.projectKey=ShiveringSquirrel_heroes-app-webapi
sonar.projectName=heroes-app-webapi
#sonar.projectVersion=1.0
sonar.projectDescription=The backend API for the Heroes test application
sonar.links.homepage=https://github.com/ShiveringSquirrel/heroes-app-webapi
sonar.links.ci=https://travis-ci.org/ShiveringSquirrel/heroes-app-webapi
sonar.links.scm=https://github.com/ShiveringSquirrel/heroes-app-webapi
sonar.links.issue=https://github.com/ShiveringSquirrel/heroes-app-webapi/issues
#sonar.sources=.
#sonar.sources=src/main
#sonar.tests=src/test
sonar.sources=heroes-app-webapi
sonar.tests=heroes-app-webapi.Tests
sonar.scm.provider=git
sonar.scm.forceReloadAll=true
sonar.dotnet.visualstudio.testProjectPattern=*.Test
sonar.language=cs
sonar.sourceEncoding=UTF-8
sonar.verbose=true
sonar.exclusions=**/*.xml
sonar.inclusions=**/*.cs
sonar.cs.nunit.reportsPaths=TestResult.xml
Building
The full build log for travis: See full build log
Some relevant snippets form the log:
$ mono --version
Mono JIT compiler version 5.20.1.19 (tarball Thu Apr 11 09:05:42 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: hybrid
GC: sgen (concurrent by default)
$ msbuild /version
Microsoft (R) Build Engine version 16.0.0.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Building with msbuild
$ msbuild /p:Configuration=Release /target:rebuild heroes-app-webapi.sln
....
302 Warning(s)
0 Error(s)
Time Elapsed 00:00:06.94
The command "msbuild /p:Configuration=Release /target:rebuild heroes-app-webapi.sln" exited with 0.
Unit testing
$ mono ./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./heroes-app-webapi.Tests/bin/Release/heroes-app-webapi.Tests.dll
....
Test Run Summary
Overall result: Passed
Test Count: 25, Passed: 25, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2019-07-14 21:00:34Z
End time: 2019-07-14 21:00:36Z
Duration: 2.559 seconds
Results (nunit3) saved as TestResult.xml
The command "mono ./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./heroes-app-webapi.Tests/bin/Release/heroes-app-webapi.Tests.dll" exited with 0.
Sonar-scanner
$ sonar-scanner -Dsonar.projectVersion=1.$TRAVIS_BUILD_NUMBER
...
21:00:40.716 DEBUG: Plugins:
...
21:00:40.717 DEBUG: * SonarC# 7.15.0.8572 (csharp)
...
21:00:46.518 DEBUG: 77 non excluded files in this Git repository
21:00:46.541 DEBUG: 'heroes-app-webapi/Global.asax.cs' indexed with language 'cs'
21:00:46.549 DEBUG: 'heroes-app-webapi/Attributes/JwtAuthenticationAttribute.cs' indexed with language 'cs'
...
21:00:46.802 INFO: 30 files indexed
21:00:46.803 INFO: 0 files ignored because of inclusion/exclusion patterns
21:00:46.804 INFO: 0 files ignored because of scm ignore settings
21:00:46.805 INFO: Quality profile for cs: Sonar way
21:00:46.806 INFO: ------------- Run sensors on module heroes-app-webapi
...
21:00:51.019 INFO: Sensor C# Properties [csharp]
21:00:51.021 WARN: No Roslyn issues report found for this project.
...
21:00:51.052 INFO: Sensor C# Unit Test Results Import [csharp]
21:00:51.054 INFO: Parsing the NUnit Test Results file /home/travis/build/ShiveringSquirrel/heroes-app-webapi/./TestResult.xml
...
21:00:51.713 INFO: SCM provider for this project is: git
21:00:51.715 INFO: 27 files to be analyzed
...
21:00:52.065 INFO: 27/27 files analyzed
21:00:52.068 INFO: Calculating CPD for 0 files
21:00:52.078 INFO: CPD calculation finished
21:00:52.235 INFO: Analysis report generated in 151ms, dir size=190 KB
21:00:52.288 INFO: Analysis report compressed in 51ms, zip size=56 KB
21:00:52.289 INFO: Analysis report generated in /home/travis/build/ShiveringSquirrel/heroes-app-webapi/.scannerwork/scanner-report
21:00:52.290 DEBUG: Upload report
21:00:52.630 DEBUG: POST 200 https://sonarcloud.io/api/ce/submit?organization=shiveringsquirrel-github&projectKey=ShiveringSquirrel_heroes-app-webapi&projectName=heroes-app-webapi | time=338ms
21:00:52.633 INFO: Analysis report uploaded in 343ms
21:00:52.637 INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarcloud.io/dashboard?id=ShiveringSquirrel_heroes-app-webapi
21:00:52.637 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
21:00:52.639 INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AWvySdH4BABcSdLoSktk
21:00:52.640 DEBUG: Report metadata written to /home/travis/build/ShiveringSquirrel/heroes-app-webapi/.scannerwork/report-task.txt
21:00:52.646 DEBUG: Post-jobs :
21:00:52.650 INFO: Analysis total time: 11.885 s
21:00:52.652 INFO: ------------------------------------------------------------------------
21:00:52.656 INFO: EXECUTION SUCCESS
21:00:52.658 INFO: ------------------------------------------------------------------------
21:00:52.662 INFO: Total time: 15.232s
21:00:52.860 INFO: Final Memory: 34M/349M
21:00:52.860 INFO: ------------------------------------------------------------------------
21:00:52.860 DEBUG: Execution getVersion
21:00:52.860 DEBUG: Execution stop
The command "sonar-scanner -Dsonar.projectVersion=1.$TRAVIS_BUILD_NUMBER" exited with 0.
So to me it all looks pretty good, only in sonarcloud.io (https://sonarcloud.io/dashboard?id=ShiveringSquirrel_heroes-app-webapi) I see nothing is analyzed.
Not even lines of code, it did update my build number and other settings. But no report or analysis. If I look at the background task:
21:00:52.639 INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AWvySdH4BABcSdLoSktk
It says "success". The other thing I've tried to investigate is the one warning I have:
21:00:51.021 WARN: No Roslyn issues report found for this project.
But it seems to me from the log that everything is analyzed properly... Any ideas?