@@ -15,67 +15,65 @@ jobs:
1515 name : Sonar Check
1616 runs-on : windows-latest
1717 steps :
18+ # 0) Checkout
1819 - uses : actions/checkout@v4
1920 with :
2021 fetch-depth : 0
2122 lfs : true
2223
24+ # 1) Setup .NET 8
2325 - uses : actions/setup-dotnet@v4
2426 with :
2527 dotnet-version : ' 8.0.x'
2628
27- # 1 ) BEGIN: SonarScanner for .NET
29+ # 2 ) BEGIN SonarScanner
2830 - name : SonarScanner Begin
2931 run : |
3032 dotnet tool install --global dotnet-sonarscanner
3133 echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH
32- #
33- # <--- Мы читаем ДВА отчета (это правильно)
34- #
3534 dotnet sonarscanner begin /k:"896Dmytro_lab" /o:"896dmytro" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/TestResults/coverage.xml,**/TestResults/coverage-echo.xml" /d:sonar.cpd.cs.minimumTokens=40 /d:sonar.cpd.cs.minimumLines=5 /d:sonar.exclusions=**/bin/**,**/obj/**,**/sonarcloud.yml /d:sonar.qualitygate.wait=true /d:sonar.coverage.exclusions="**/NetSdrClientAppTests/**,**/EchoServer.Tests/**,**/*.csproj"
3635 shell : pwsh
3736
38- # 2) BUILD
37+ # 3) Restore & Build
3938 - name : Restore
4039 run : dotnet restore NetSdrClient.sln
4140 - name : Build
4241 run : dotnet build NetSdrClient.sln -c Release --no-restore
4342
44- #
45- # <--- НОВЫЙ ШАГ: Создаем папки для отчетов
46- #
43+ # 4) Create TestResults folders (Coverlet fix)
4744 - name : Create TestResults directories
4845 run : |
4946 mkdir -Force .\NetSdrClientAppTests\TestResults
5047 mkdir -Force .\EchoServer.Tests\TestResults
5148 shell : pwsh
5249
53- # 3) TEST & COVERAGE
50+ # 5) Run Tests with Coverage
5451 - name : Tests with coverage (OpenCover)
5552 run : |
5653 #
57- # <--- Мы используем ci.runsettings для отключения параллельного запуска
54+ # <--- ФИНАЛЬНОЕ ИСПРАВЛЕНИЕ: Добавлена "двойная страховка" /p:MaxCpuCount=1
5855 #
5956
60- # Тест 1 (NetSdrClientApp)
57+ # NetSdrClientAppTests
6158 dotnet test NetSdrClientAppTests/NetSdrClientAppTests.csproj -c Release --no-build `
6259 --settings "ci.runsettings" `
6360 /p:CollectCoverage=true `
6461 /p:CoverletOutput=TestResults/coverage.xml `
6562 /p:CoverletOutputFormat=opencover `
66- /p:CoverletExcludeByAttribute="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"
63+ /p:CoverletExcludeByAttribute="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" `
64+ /p:MaxCpuCount=1
6765
68- # Тест 2 ( EchoServer)
66+ # EchoServer.Tests
6967 dotnet test EchoServer.Tests/EchoServer.Tests.csproj -c Release --no-build `
7068 --settings "ci.runsettings" `
7169 /p:CollectCoverage=true `
7270 /p:CoverletOutput=TestResults/coverage-echo.xml `
7371 /p:CoverletOutputFormat=opencover `
74- /p:CoverletExcludeByAttribute="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"
75-
72+ /p:CoverletExcludeByAttribute="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" `
73+ /p:MaxCpuCount=1
7674 shell : pwsh
7775
78- # 4 ) END: SonarScanner
76+ # 6 ) END SonarScanner
7977 - name : SonarScanner End
8078 run : dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
8179 shell : pwsh
0 commit comments