This allows running locally for testing purposes.json-serializing-nullable-fields-issue
parent
40dda4dfa3
commit
8d18f98901
@ -1,2 +1,3 @@
|
||||
dotnet tool update --global GitVersion.Tool
|
||||
Install-Module -Force -Name ChangelogManagement
|
||||
dotnet tool update --global dotnet-sonarscanner
|
||||
|
@ -0,0 +1,42 @@
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $SonarToken,
|
||||
|
||||
[switch] $Details
|
||||
)
|
||||
|
||||
$version = $(dotnet-gitversion /showvariable semver)
|
||||
if ($LASTEXITCODE -ne 0) { throw "Failed: dotnet gitversion" }
|
||||
|
||||
$beginArgs = @(
|
||||
"-o:recyclarr"
|
||||
"-k:recyclarr_recyclarr"
|
||||
"-n:Recyclarr"
|
||||
"-v:$version"
|
||||
"-d:sonar.token=$SonarToken"
|
||||
"-d:sonar.host.url=https://sonarcloud.io"
|
||||
"-d:sonar.cs.opencover.reportsPaths=**/TestResults/*/coverage.opencover.xml"
|
||||
)
|
||||
|
||||
if ($Details) {
|
||||
$beginArgs += "-d:sonar.verbose=true"
|
||||
}
|
||||
|
||||
"Args: $beginArgs"
|
||||
dotnet sonarscanner begin @beginArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Failed: sonarscanner begin" }
|
||||
|
||||
try {
|
||||
# Run a full build command because if we just do the tests, it will not build everything.
|
||||
# Building everything is important to ensure we analyze all code in the solution.
|
||||
dotnet build src
|
||||
if ($LASTEXITCODE -ne 0) { throw "Failed: dotnet build" }
|
||||
|
||||
dotnet test src --no-build --collect:"XPLat Code Coverage;Format=opencover"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Failed: dotnet test" }
|
||||
}
|
||||
finally {
|
||||
dotnet sonarscanner end "-d:sonar.token=$SonarToken"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Failed: sonarscanner end" }
|
||||
}
|
Loading…
Reference in new issue