Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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
You can’t perform that action at this time.