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
+10 -5
+10 -5
View File
@@ -51,19 +51,24 @@ before_build:
if($Env:PLATFORM -eq 'x64') if($Env:PLATFORM -eq 'x64')
{ {
choco install "msbuild-sonarqube-runner" -y if ($Env:APPVEYOR_PULL_REQUEST_NUMBER){
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" } choco install "msbuild-sonarqube-runner" -y
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" } 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: build:
project: Vocaluxe.sln project: Vocaluxe.sln
verbosity: normal verbosity: normal
after_build: after_build:
- ps: | - 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" SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken"
} }
./.appveyor/runGitLink.ps1 ./.appveyor/runGitLink.ps1
cd Output cd Output