Fixing SonarCloud integration - 7

This commit is contained in:
2024-05-05 02:44:46 +02:00
parent a1a1a667b3
commit 23ca30f084

View File

@@ -43,21 +43,21 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
dotnet test ./MainProject.Tests/MainProject.Tests.csproj --no-restore --configuration Release --collect:"XPlat Code Coverage;Format=opencover" --logger "trx;LogFileName=test-results.trx" --results-directory "./TestResults"
# dotnet test ./MainProject.Tests/MainProject.Tests.csproj --no-restore --configuration Release --collect:"XPlat Code Coverage;Format=opencover" --logger "trx;LogFileName=test-results.trx" --results-directory "./TestResults"
coverage_file=$(find ./TestResults -name "coverage.opencover.xml" -type f)
# coverage_file=$(find ./TestResults -name "coverage.opencover.xml" -type f)
if [-f "$coverage_file"]; then
.sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.opencover.reportsPaths="$coverage_file"
dotnet restore
dotnet build --no-incremental --no-restore --configuration Release
.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
else
echo "File di copertura non trovato."
exit 1
fi
# .\.sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.opencover.reportsPaths="./TestResults"
# dotnet restore
# dotnet build --no-incremental --no-restore --configuration Release
# dotnet test ./MainProject.Tests/MainProject.Tests.csproj --no-restore --configuration Release --collect:"Code Coverage" --logger "trx;LogFileName=test-results.trx" --results-directory "./TestResults"
# .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
# if [-f "$coverage_file"]; then
# .sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.opencover.reportsPaths="$coverage_file"
# dotnet restore
# dotnet build --no-incremental --no-restore --configuration Release
# .sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
# else
# echo "File di copertura non trovato."
# exit 1
# fi
.\.sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.opencover.reportsPaths="./TestResults/**/coverage.opencover.xml"
dotnet restore
dotnet build --no-incremental --no-restore --configuration Release
dotnet test ./MainProject.Tests/MainProject.Tests.csproj --no-restore --configuration Release --collect:"XPlat Code Coverage;Format=opencover" --logger "trx;LogFileName=test-results.trx" --results-directory "./TestResults"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"