From 48dfcb717ea462c981e857427e64c51217d5c93d Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 21:09:09 +0200 Subject: [PATCH] Limit SonarQube analysis to develop branch and PRs --- appveyor.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 32e6608c..f152f728 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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