Hi,
I’m working on tests for a potential global implementation of Sonar on all our projects.
I have issues that I can solve one by one, but now I need help.
We are in .NET 4.7.2 in GitHub Action. So I’ve been very strongly inspired by the “ConfigureWith” > “GitHub Actions” model.
I added :
- The checkout with submodules
- nuget restore
- microsoft/setup-msbuild@v1.1
Now my project compiles well, sonar installs well, but I have no files analyzed in sonarcloud, only the Qualty Gate passed… I have no exclusion in the Analysis Scope.
The only strange thing is finally the warning
File referenced by the protobuf ‘CopyPasteTokenInfo’ does not exist in the analysis context
I’ve searched the web but I don’t understand how to solve it in GitHub Action. Is it related to MS-Build?
Bellow the log output, the yaml, and 10_Build and scan.txt in attachment.
Many thanks in advance !
- ALM: GitHub
- CI : GitHub Action
- Scanner command: see yaml bellow
- Languages of the repository: C# .NET 4.7
- Error: File referenced by the protobuf ‘CopyPasteTokenInfo’ does not exist
- Steps to reproduce: at every run
[...]
**WARN: File 'D:\a\TEST\TEST\LIB_TBZ\Utils\TBZOtherUtils.cs' referenced by the protobuf 'CopyPasteTokenInfo' does not exist in the analysis context
WARN: File 'D:\a\TEST\TEST\LIB_TBZ\Wrapper\SBuilder.cs' referenced by the protobuf 'CopyPasteTokenInfo' does not exist in the analysis context**
INFO: Importing 1 Roslyn report
INFO: Found 1 MSBuild C# project: 1 MAIN project.
INFO: Sensor C# [csharp] (done) | time=500ms
INFO: Sensor Analysis Warnings import [csharp] (done) | time=0ms
INFO: Sensor C# File Caching Sensor [csharp] (done) | time=0ms
INFO: Sensor Zero Coverage Sensor (done) | time=16ms
INFO: CPD Executor Calculating CPD for 3 files
INFO: CPD Executor CPD calculation finished (done) | time=16ms
INFO: SCM writing changed lines (done) | time=0ms
INFO: Analysis report generated in 2282ms, dir size=232 KB
INFO: Analysis report compressed in 16ms, zip size=50 KB
INFO: Analysis report uploaded in 781ms
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=*
INFO: Sensor cache published successfully
INFO: Analysis total time: 25.521 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 54.967s
INFO: Final Memory: 36M/124M
INFO: ------------------------------------------------------------------------
The SonarScanner CLI has finished
13:54:42.185 Post-processing succeeded.
[10_Build and scan.zip|attachment](upload://na7Ae7rGuThBx8wolfxrIFIfKBg.zip) (21.7 KB)
jobs:
build_analysis:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.SUBMODULE_CLONE }}
submodules: true
fetch-depth: 0
- run: nuget restore "${{ github.workspace }}\${{ github.event.repository.name }}.sln"
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: "zulu"
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- uses: microsoft/setup-msbuild@v1.1 # Ajoute MSBuild au path
- name: Build and scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner.exe begin /k:"tebicomSA_${{ github.event.repository.name }}" /o:"tebicom" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
MSBuild.exe "${{ github.workspace }}\${{ github.event.repository.name }}.sln" /property:Configuration=Debug
.\.sonar\scanner\dotnet-sonarscanner.exe end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"