From 23ca30f084a628e33df3a6cf69ba6ce88a300fd3 Mon Sep 17 00:00:00 2001 From: csimonapastore Date: Sun, 5 May 2024 02:44:46 +0200 Subject: [PATCH] Fixing SonarCloud integration - 7 --- .github/workflows/build.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c13daf..ffe21c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }}"