From 52ac408bbd38fa5d10fd7fc9acd0a3b693cd6762 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 18:00:39 +0200 Subject: [PATCH 01/15] Add SonarCloud analysis to the build pipeline (first test) --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index deca340e..7f70c73c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,7 @@ init: - git config --global core.autocrlf true install: - ps: | + $Env:VOCALUXE_SKIP_POSTBUILD = $true $Env:CurrentCommitSha = "$(git rev-parse --verify HEAD)" if((-not $Env:githubRepoApiUri) -or ($Env:APPVEYOR_ACCOUNT_NAME -eq "VocaluxeBuildBot")){ @@ -46,12 +47,16 @@ before_build: Write-Warning "Genius-Video download failed" } nuget restore -DisableParallelProcessing + 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" /d:sonar.login="$Env:SonarQubeToken" } build: project: Vocaluxe.sln verbosity: normal after_build: - ps: | + SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" ./.appveyor/runGitLink.ps1 cd Output From 5161b09433783c1bdf0d046372cb769466f76635 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 18:52:26 +0200 Subject: [PATCH 02/15] Exclude PitchTracker project from sonarqube analysis --- PitchTracker/PitchTracker.vcxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PitchTracker/PitchTracker.vcxproj b/PitchTracker/PitchTracker.vcxproj index 89194dd7..e601abf7 100644 --- a/PitchTracker/PitchTracker.vcxproj +++ b/PitchTracker/PitchTracker.vcxproj @@ -225,4 +225,8 @@ xcopy "$(OutDir)*.pdb" "$(SolutionDir)Output\libs\unmanaged\x86\" /I /Y + + + true + \ No newline at end of file From 14ad783c8f64c8a05f17db4669ec780265db27f6 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 19:15:50 +0200 Subject: [PATCH 03/15] Publish version number to sonarcloud --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7f70c73c..061592bc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,10 +46,10 @@ before_build: { Write-Warning "Genius-Video download failed" } - nuget restore -DisableParallelProcessing + nuget restore -DisableParallelProcessing 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" /d:sonar.login="$Env:SonarQubeToken" } + 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" /d:sonar.projectVersion="$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken" } build: project: Vocaluxe.sln From 71126989a7abfb6b60335e89a3a6abaa77f9e749 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 19:27:00 +0200 Subject: [PATCH 04/15] SonarQube analysis only for x64 builds (as SonarCloud does not support multiple builds per version) --- appveyor.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 061592bc..8e3d8162 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,17 +46,24 @@ before_build: { Write-Warning "Genius-Video download failed" } - nuget restore -DisableParallelProcessing - 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" /d:sonar.projectVersion="$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken" } - + + 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" /d:sonar.projectVersion="$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken" } + } build: project: Vocaluxe.sln verbosity: normal after_build: - ps: | - SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" + if($Env:PLATFORM -eq 'x64') + { + SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" + } ./.appveyor/runGitLink.ps1 cd Output From 5c2bc2bd1b4fa0079cf98633928d8a3746b4fac5 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 19:36:16 +0200 Subject: [PATCH 05/15] Use prefix '/v:' instead injecting 'sonar.projectVersion' property --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8e3d8162..32e6608c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,7 +53,7 @@ before_build: { 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" /d:sonar.projectVersion="$Env:GIT_VERSION_TAG" /d:sonar.login="$Env:SonarQubeToken" } + 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" } } build: project: Vocaluxe.sln 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 06/15] 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 From 41526752c4fd450ab9818226709191d3006ae549 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 21:50:41 +0200 Subject: [PATCH 07/15] Changed to SonarScanner.MSBuild.exe as SonarQube.Scanner.MSBuild.exe is deprecated --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f152f728..1cc3e9eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,11 +53,11 @@ before_build: { 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" + SonarScanner.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" + SonarScanner.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: @@ -66,7 +66,7 @@ build: after_build: - ps: | 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" + SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" } ./.appveyor/runGitLink.ps1 From 639c29a6194ed87eaed0a004fc12568e7f9ff53e Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 30 Apr 2018 22:46:11 +0200 Subject: [PATCH 08/15] Removed sonarqube preview setting for pr --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1cc3e9eb..937eb477 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,7 +53,7 @@ before_build: { if ($Env:APPVEYOR_PULL_REQUEST_NUMBER){ choco install "msbuild-sonarqube-runner" -y - SonarScanner.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" + SonarScanner.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.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 From 36a836d95b29e2fd2fe99e69dac70a7e04ce2d49 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Tue, 1 May 2018 12:40:18 +0200 Subject: [PATCH 09/15] Try to get PR check running --- appveyor.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 937eb477..ad22665f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,11 +53,23 @@ before_build: { if ($Env:APPVEYOR_PULL_REQUEST_NUMBER){ choco install "msbuild-sonarqube-runner" -y - SonarScanner.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.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" + SonarScanner.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.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER" ` + /d:"sonar.pullrequest.base=$env:APPVEYOR_REPO_BRANCH" ` + /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH" } elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){ choco install "msbuild-sonarqube-runner" -y - SonarScanner.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" + SonarScanner.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: From 2748148a1d763bb0d1be504c4386e4ca0323934c Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Tue, 1 May 2018 13:24:22 +0200 Subject: [PATCH 10/15] Submit test result to sonarcloud --- appveyor.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ad22665f..ed3f417b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -69,7 +69,8 @@ before_build: /d:sonar.organization="lukeiam-github" ` /d:sonar.host.url="https://sonarcloud.io" ` /v:"$Env:GIT_VERSION_TAG" ` - /d:sonar.login="$Env:SonarQubeToken" + /d:sonar.login="$Env:SonarQubeToken" ` + /d:sonar.cs.nunit.reportsPaths="$env:APPVEYOR_BUILD_FOLDER\TestResult.xml" } } build: @@ -77,10 +78,6 @@ build: verbosity: normal after_build: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ - SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" - } - ./.appveyor/runGitLink.ps1 cd Output @@ -110,6 +107,11 @@ after_build: .\.appveyor\nightlyDetect.ps1 .\.appveyor\moveTagForSpecialBranches.ps1 } +after_test: +- ps: | + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" + } before_deploy: - ps: ./.appveyor/prepareDeploy.ps1 after_deploy: From 0d69b5ee62bbed8002e37fab2f4edf4cdfdfe704 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Tue, 1 May 2018 15:20:42 +0200 Subject: [PATCH 11/15] Use OpenCover to generate coverage statistics for SonarSloud --- appveyor.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ed3f417b..dc0f01e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,7 +33,8 @@ install: } else{ $Env:TAG_NAME_WITH_BRANCH_NAME_FALLBACK = $Env:APPVEYOR_REPO_BRANCH - } + } + choco install "opencover.portable" -y before_build: - ps: | Try @@ -63,14 +64,15 @@ before_build: /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH" } elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){ - choco install "msbuild-sonarqube-runner" -y + choco install "msbuild-sonarqube-runner" -y SonarScanner.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" ` - /d:sonar.cs.nunit.reportsPaths="$env:APPVEYOR_BUILD_FOLDER\TestResult.xml" + /d:sonar.cs.nunit.reportsPaths=".\TestResult.xml" ` + /d:sonar.cs.opencover.reportsPaths=".\CoverageResult.xml" } } build: @@ -107,6 +109,17 @@ after_build: .\.appveyor\nightlyDetect.ps1 .\.appveyor\moveTagForSpecialBranches.ps1 } +test_script: +- ps: | + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml" + } + else{ + nunit3-console.exe ".\Tests\bin\Release\Tests.dll" --result=".\TestResult.xml;format=AppVeyor" + } + $wc = New-Object 'System.Net.WebClient' + $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResult.xml)) + after_test: - ps: | if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ From 60d633636683fda2591b6cab96fdea85d074ccef Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Tue, 1 May 2018 15:46:41 +0200 Subject: [PATCH 12/15] Change main branch to sonarcloud for testing --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dc0f01e2..641400d5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,7 +63,7 @@ before_build: /d:"sonar.pullrequest.base=$env:APPVEYOR_REPO_BRANCH" ` /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH" } - elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){ + elseif($Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud'){ choco install "msbuild-sonarqube-runner" -y SonarScanner.MSBuild.exe begin ` /k:"lukeIam_Vocaluxe" ` @@ -111,7 +111,7 @@ after_build: } test_script: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud')){ OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml" } else{ @@ -122,7 +122,7 @@ test_script: after_test: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud')){ SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" } before_deploy: From a8aec3ac912431361ebd0872cf43be3f89380602 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Thu, 3 May 2018 20:23:42 +0200 Subject: [PATCH 13/15] Revert "Change main branch to sonarcloud for testing" This reverts commit 60d633636683fda2591b6cab96fdea85d074ccef. --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 641400d5..dc0f01e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,7 +63,7 @@ before_build: /d:"sonar.pullrequest.base=$env:APPVEYOR_REPO_BRANCH" ` /d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH" } - elseif($Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud'){ + elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){ choco install "msbuild-sonarqube-runner" -y SonarScanner.MSBuild.exe begin ` /k:"lukeIam_Vocaluxe" ` @@ -111,7 +111,7 @@ after_build: } test_script: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud')){ + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml" } else{ @@ -122,7 +122,7 @@ test_script: after_test: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'sonarcloud')){ + if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" } before_deploy: From 7b9a7298a21c70db8d74499b188c6a4888be7992 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Thu, 3 May 2018 20:36:42 +0200 Subject: [PATCH 14/15] Changes to work with Vocaluxe/Vocaluxe --- appveyor.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dc0f01e2..8fdf1640 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,6 +37,13 @@ install: choco install "opencover.portable" -y before_build: - ps: | + $Env:MAIN_REPO = $False + + if($Env:APPVEYOR_REPO_NAME -eq "Vocaluxe/Vocaluxe"){ + $Env:MAIN_REPO = $True + Write-Host "Main repo Vocaluxe/Vocaluxe detected" + } + Try { Start-FileDownload 'https://github.com/lukeIam/VocaluxeDependencies/blob/master/zips/themes/vocaluxe.themes.genius.video.zip?raw=true' @@ -50,13 +57,13 @@ before_build: nuget restore -DisableParallelProcessing - if($Env:PLATFORM -eq 'x64') + if($Env:MAIN_REPO -and ($Env:PLATFORM -eq 'x64')) { if ($Env:APPVEYOR_PULL_REQUEST_NUMBER){ choco install "msbuild-sonarqube-runner" -y SonarScanner.MSBuild.exe begin ` - /k:"lukeIam_Vocaluxe" ` - /d:sonar.organization="lukeiam-github" ` + /k:"Vocaluxe" ` + /d:sonar.organization="vocaluxe" ` /d:sonar.host.url="https://sonarcloud.io" ` /d:sonar.login="$Env:SonarQubeToken" ` /d:"sonar.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER" ` @@ -66,8 +73,8 @@ before_build: elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){ choco install "msbuild-sonarqube-runner" -y SonarScanner.MSBuild.exe begin ` - /k:"lukeIam_Vocaluxe" ` - /d:sonar.organization="lukeiam-github" ` + /k:"Vocaluxe" ` + /d:sonar.organization="vocaluxe" ` /d:sonar.host.url="https://sonarcloud.io" ` /v:"$Env:GIT_VERSION_TAG" ` /d:sonar.login="$Env:SonarQubeToken" ` @@ -82,14 +89,7 @@ after_build: - ps: | ./.appveyor/runGitLink.ps1 - cd Output - - $Env:MAIN_REPO = $False - - if($Env:APPVEYOR_REPO_NAME -eq "Vocaluxe/Vocaluxe"){ - $Env:MAIN_REPO = $True - Write-Host "Main repo Vocaluxe/Vocaluxe detected" - } + cd Output $forkBuildTag = "" if(($Env:MAIN_REPO -ne $True) -or ($Env:APPVEYOR_ACCOUNT_NAME -ne "VocaluxeBuildBot")){ @@ -111,7 +111,7 @@ after_build: } test_script: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + if (($Env:MAIN_REPO) -and ($Env:PLATFORM -eq 'x64') -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml" } else{ @@ -122,7 +122,7 @@ test_script: after_test: - ps: | - if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ + if (($Env:MAIN_REPO) -and ($Env:PLATFORM -eq 'x64') -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ SonarScanner.MSBuild.exe end /d:sonar.login="$Env:SonarQubeToken" } before_deploy: From ed4517a9200e6690a78e3bbb7bbf95269d156027 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Thu, 3 May 2018 21:03:33 +0200 Subject: [PATCH 15/15] Trigger ci build