Limit SonarQube analysis to develop branch and PRs

This commit is contained in:
lukeIam committed 2018-04-30 21:09:09 +02:00
1 parent 5c2bc2bd1b
commit 48dfcb717e
1 file changed
+11 -6
+11 -6
View File
@@ -50,20 +50,25 @@ before_build:
nuget restore -DisableParallelProcessing
if($Env:PLATFORM -eq 'x64')
{
choco install "msbuild-sonarqube-runner" -y
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { SonarQube.Scanner.MSBuild.exe begin /k:"lukeIam_Vocaluxe" /d:sonar.organization="lukeiam-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$Env:SonarQubeToken" /d:"sonar.analysis.mode=preview" /d:"sonar.pullrequest.provider=GitHub" /d:"sonar.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER" /d:"sonar.pullrequest.github.repository=lukeIam/Vocaluxe" /d:"sonar.pullrequest.base=$env:APPVEYOR_REPO_BRANCH" /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME/$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH" }
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { SonarQube.Scanner.MSBuild.exe begin /k:"lukeIam_Vocaluxe" /d:sonar.organization="lukeiam-github" /d:sonar.host.url="https://sonarcloud.io" /v:"$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken" }
{
if ($Env:APPVEYOR_PULL_REQUEST_NUMBER){
choco install "msbuild-sonarqube-runner" -y
SonarQube.Scanner.MSBuild.exe begin /k:"lukeIam_Vocaluxe" /d:sonar.organization="lukeiam-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$Env:SonarQubeToken" /d:"sonar.analysis.mode=preview" /d:"sonar.pullrequest.provider=GitHub" /d:"sonar.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER" /d:"sonar.pullrequest.github.repository=lukeIam/Vocaluxe" /d:"sonar.pullrequest.base=$env:APPVEYOR_REPO_BRANCH" /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME/$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"
}
elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){
choco install "msbuild-sonarqube-runner" -y
SonarQube.Scanner.MSBuild.exe begin /k:"lukeIam_Vocaluxe" /d:sonar.organization="lukeiam-github" /d:sonar.host.url="https://sonarcloud.io" /v:"$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken"
}
}
build:
project: Vocaluxe.sln
verbosity: normal
after_build:
- ps: |
if($Env:PLATFORM -eq 'x64')
{
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){
SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken"
}
./.appveyor/runGitLink.ps1
cd Output