Bump NUnit.Analyzers from 3.9.0 to 4.11.2 #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| # 1) Checkout | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # 2) Setup .NET | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| # 3) Install 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:"Yarickprogramist_NetSdrClient" ` | |
| /o:"yarickprogramist" ` | |
| /d:sonar.token="${{ secrets.SONAR_TOKEN }}" ` | |
| /d:sonar.cs.opencover.reportsPaths="**/TestResults/coverage.opencover.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 | |
| shell: pwsh | |
| # 4) Restore & build | |
| - name: Restore | |
| run: dotnet restore NetSdrClient.sln | |
| - name: Build | |
| run: dotnet build NetSdrClient.sln -c Release --no-restore | |
| # 5) Run tests with coverage | |
| - name: Run Tests with Coverlet | |
| run: | | |
| dotnet test NetSdrClientAppTests/NetSdrClientAppTests.csproj -c Release ` | |
| /p:CollectCoverage=true ` | |
| /p:CoverletOutputFormat=opencover ` | |
| /p:CoverletOutput=TestResults/ ` | |
| --results-directory TestResults | |
| dotnet test EchoServerTests/EchoServerTests.csproj -c Release ` | |
| /p:CollectCoverage=true ` | |
| /p:CoverletOutputFormat=opencover ` | |
| /p:CoverletOutput=TestResults/ ` | |
| --results-directory TestResults | |
| shell: pwsh | |
| # 6) Verify coverage files exist | |
| - name: Verify Coverage Files | |
| run: | | |
| Write-Host "=== Coverage files in NetSdrClientAppTests ===" | |
| Get-ChildItem -Recurse -Filter "*.xml" -Path NetSdrClientAppTests\TestResults -ErrorAction SilentlyContinue | Select-Object FullName | |
| Write-Host "`n=== Coverage files in EchoServerTests ===" | |
| Get-ChildItem -Recurse -Filter "*.xml" -Path EchoServerTests\TestResults -ErrorAction SilentlyContinue | Select-Object FullName | |
| if (-Not (Test-Path "NetSdrClientAppTests\TestResults\coverage.opencover.xml")) { | |
| Write-Error "NetSdrClientAppTests coverage file not found!" | |
| } | |
| if (-Not (Test-Path "EchoServerTests\TestResults\coverage.opencover.xml")) { | |
| Write-Error "EchoServerTests coverage file not found!" | |
| } | |
| Write-Host "`n✓ All coverage files found" | |
| shell: pwsh | |
| # 7) End SonarScanner | |
| - name: SonarScanner End | |
| run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
| shell: pwsh |