-
Notifications
You must be signed in to change notification settings - Fork 1
/
appveyor.yml
27 lines (27 loc) · 1.46 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
version: 1.0.{build}
image: Visual Studio 2019
branches:
only:
- master
environment:
my_encrypted_sonarqube_token:
secure: auSP7uJIC8Y5I0AW97f0ANIOLXxkszux38+nFJhry4PFvH1MBd1xfBFMcA30a8Z9
install:
- choco install "sonarscanner-msbuild-netcoreapp2.0" -y
before_build:
- cmd: nuget restore Src/DotNetFlags.sln
- dotnet tool install -g dotnet-sonarscanner
# AppVeyor does not decrypt the secure env vars for PR builds (this prevents someone from submitting PR with malicious build script displaying those variables). So when AppVeyor initiates a Sonar analysis it immediately fails with error "The format of the analysis property sonar.login= is invalid". The only solution is to prevent PR builds initiating Sonar analysis using powershell. See https://medium.com/@stef.heyenrath/how-to-fix-sonarcloud-issue-in-a-github-pr-when-using-appveyor-integration-8909b49406b4
- ps: 'if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { & dotnet sonarscanner begin /key:"DotNetFlags" /d:"sonar.host.url=https://sonarcloud.io" /d:"sonar.login=$env:my_encrypted_sonarqube_token" /o:"gregtrevellick-github" }'
build:
project: Src/DotNetFlags.sln
verbosity: minimal
after_build:
- ps: 'if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { & dotnet sonarscanner end /d:"sonar.login=$env:my_encrypted_sonarqube_token" }'
notifications:
- provider: Email
to:
- gtrevellick@googlemail.com
on_build_success: false
on_build_failure: false
on_build_status_changed: true