Skip to content

Instantly share code, notes, and snippets.

@juanluelguerre
Last active January 12, 2019 19:45
Show Gist options
  • Save juanluelguerre/a03a5e4756a3c09c1ae8603ecacbba30 to your computer and use it in GitHub Desktop.
Save juanluelguerre/a03a5e4756a3c09c1ae8603ecacbba30 to your computer and use it in GitHub Desktop.
@echo off
setlocal
set /p TOKEN=<sonar.token
IF [%1]==[] SET SLN="./ElGuerre.Taskin.Api.sln"
IF NOT [%1]==[] SET SLN=%1
dotnet build-server shutdown
del .\.sonarqube /S /Q
dotnet tool install --global dotnet-sonarscanner > nul
dotnet tool install --global dotnet-reportgenerator-globaltool > nul
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="%CD%\TestResults\coverage.opencover.xml" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*,**/Migrations/**" /d:sonar.coverage.exclusions="test/**"
dotnet restore %SLN%
dotnet build %SLN%
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=OpenCover /p:CoverletOutput=./TestResults/ ./test/ElGuerre.Taskin.Api.Tests/ElGuerre.Taskin.Api.Tests.csproj
reportgenerator -reports:%CD%/TestResults/coverage.opencover.xml -targetdir:./TestResults/Reports/ -reportTypes:"HTML;HTMLInline;Cobertura"
dotnet sonarscanner end /d:sonar.login="%TOKEN%"
.\TestResults\reports\index.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment