Skip to content

update

update #57

Workflow file for this run

name: SonarCloud analysis
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
sonar-check:
name: Sonar Check
runs-on: windows-latest
steps:
- uses: actions/checkout@v4 # <-- ВИПРАВЛЕНО: Відновлено коректне використання '- uses:'
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# 1) BEGIN: SonarScanner for .NET
- name: SonarScanner Begin
run: |
dotnet tool install --global dotnet-sonarscanner
echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH
dotnet sonarscanner begin `
/k:"YehorYurch5_NetSdrClient" `
/o:"yehoryurch5-kai" `
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" `
/d:sonar.cs.opencover.reportsPaths="EchoServerTests/TestResults/coverage.xml,NetSdrClientAppTests/TestResults/coverage.xml" `
/d:sonar.cpd.cs.minimumTokens=40 `
/d:sonar.cpd.cs.minimumLines=5 `
/d:sonar.exclusions="**/bin/**,**/obj/**,**/sonarcloud.yml,**/EchoTspServer/Presentation/Program.cs,**/NetSdrClient/NetSdrClientApp/Program.cs,**/Program.cs" `
/d:sonar.coverage.exclusions="**/Program.cs,**/EchoTspServer/Presentation/Program.cs,**/NetSdrClientApp/Program.cs"
shell: pwsh
# 2) BUILD & TEST
- name: Restore
run: dotnet restore NetSdrClient.sln
- name: Build
run: dotnet build NetSdrClient.sln -c Release --no-restore
- name: Tests with coverage (OpenCover)
run: |
# 🔹 Автоматично запускає всі тестові проєкти у рішенні (.sln)
dotnet test NetSdrClient.sln -c Release --no-build `
/p:CollectCoverage=true `
/p:CoverletOutput=TestResults/coverage.xml `
/p:CoverletOutputFormat=opencover
shell: pwsh
# 3) END: SonarScanner
- name: SonarScanner End
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
shell: pwsh