Last active
January 12, 2019 19:45
-
-
Save juanluelguerre/6a917542047172767fda7aa0b4d6ca9e to your computer and use it in GitHub Desktop.
This file contains 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
clear | |
TOKEN=$(<sonar.token) | |
if [ -z "$1" ] | |
then | |
SLN="ElGuerre.Taskin.Api.sln" | |
else | |
SLN="$1" | |
fi | |
dotnet build-server shutdown | |
rm -rf ./.sonarqube | |
# "| true" avoid red color to show messages | |
dotnet tool install --global dotnet-sonarscanner | true | |
dotnet tool install --global dotnet-reportgenerator-globaltool | true | |
dotnet sonarScanner begin /k:'Taskin' /d:sonar.organization='juanluelguerre-github' /d:sonar.host.url='https://sonarcloud.io' /d:sonar.login="$TOKEN" /d:sonar.language='cs' /d:sonar.cs.opencover.reportsPaths=$(pwd)/TestResults/coverage.opencover.xml /d:sonar.exclusions='**/bin/**/*,**/obj/**/*,**/Migrations/**' /d:sonar.coverage.exclusions='test/**' | |
dotnet restore $SLN | |
# dotnet build $SLN # It doesn't woks on MAC for msbuild 16. Issue: https://github.com/SonarSource/sonar-scanner-msbuild/issues/649 | |
# Neither force for: dotnet msbuild /toolsversion:15 ElGuerre.Taskin.Api.sln | |
msbuild $SLN # It works | |
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=OpenCover /p:CoverletOutput=$(pwd)/TestResults/ ./test/ElGuerre.Taskin.Api.Tests/ElGuerre.Taskin.Api.Tests.csproj | |
reportgenerator -reports:$(pwd)/TestResults/coverage.opencover.xml -targetdir:$(pwd)/TestResults/Reports/ -reportTypes:"HTMLInline;Cobertura" | |
dotnet sonarScanner end /d:sonar.login="$TOKEN" | |
open ./TestResults/Reports/index.htm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment