-
Notifications
You must be signed in to change notification settings - Fork 1
/
appveyor.yml
72 lines (72 loc) · 4.56 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
version: 1.0.{build}
image: Visual Studio 2017
configuration: Release
environment:
SONAR_APIKEY:
secure: EYzruYp2xqMzztgVQEnax0Wnfqc46jrg2JlF/tYOQPzCktQ9h6D/d0MqqyAhyUvJ
GITHUB_APIKEY:
secure: mNS8sa53WlYK5HtcTYXYpPXqwt+xndOxvFBu22ynD7wEKeOrq+P70L4FOkPCL7wY
dotnet_csproj:
patch: true
file: '**\*.csproj'
version: $(appveyor_build_version)
package_version: $(appveyor_build_version)
assembly_version: $(appveyor_build_version)
file_version: $(appveyor_build_version)
informational_version: $(appveyor_build_version)
init:
- ps: choco install msbuild-sonarqube-runner -y
- ps: choco install opencover.portable -y
install:
- ps: New-Item .\reports -ItemType directory
- ps: dotnet add .\tests\PeselValidatorTests\PeselValidatorTests.csproj package xunit.runner.utility
- ps: dotnet restore .\PeselValidator.sln
before_build:
- ps: >-
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
Write-Host "Starting sonar scan in PR Mode"
if ("$env:APPVEYOR_REPO_BRANCH" -eq "develop") {
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.pullrequest.branch="develop" /d:sonar.pullrequest.base="master" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml" /d:sonar.pullrequest.key="$env:APPVEYOR_PULL_REQUEST_NUMBER"
}
else {
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.pullrequest.branch="$env:APPVEYOR_REPO_BRANCH" /d:sonar.pullrequest.base="develop" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml" /d:sonar.pullrequest.key="$env:APPVEYOR_PULL_REQUEST_NUMBER"
}
}
elseif ("$env:APPVEYOR_REPO_BRANCH" -eq "develop") {
Write-Host "Starting sonar scan in DEVELOP Mode"
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.branch.name="develop" /d:sonar.branch.base="master" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml"
}
elseif ("$env:APPVEYOR_REPO_BRANCH" -eq "master") {
Write-Host "Starting sonar scan in MASTER Mode"
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml"
}
elseif ("$env:APPVEYOR_REPO_BRANCH".StartsWith("release", "CurrentCultureIgnoreCase") -or "$env:APPVEYOR_REPO_BRANCH".StartsWith("hotfix", "CurrentCultureIgnoreCase")) {
Write-Host "Starting sonar scan in RELEASE/HOTFIX Mode"
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.branch.name="$env:APPVEYOR_REPO_BRANCH" /d:sonar.branch.base="master" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml"
}
else {
Write-Host "Starting sonar scan in Feature/BugFix Mode"
SonarQube.Scanner.MSBuild.exe begin /o:"rychu-pawel-github" /k:"PeselValidator" /d:sonar.login="$env:SONAR_APIKEY" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.branch.name="$env:APPVEYOR_REPO_BRANCH" /d:sonar.branch.base="develop" /d:sonar.cs.opencover.reportsPaths=".\Reports\OpenCover.xml"
}
build_script:
- ps: dotnet build .\PeselValidator.sln -c Release
test_script:
- ps: dotnet build .\PeselValidator.sln /p:DebugType=Full
- ps: OpenCover.Console.exe -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test .\tests\PeselValidatorTests\PeselValidatorTests.csproj --logger:trx --no-build" -filter:"+[PeselValidator*]*" -oldStyle -register:user -output:".\Reports\OpenCover.xml"
after_test:
- ps: SonarQube.Scanner.MSBuild.exe end /d:sonar.login="$env:SONAR_APIKEY"
artifacts:
- path: .\src\PeselValidator\bin\Release\Rychusoft.Validators.PeselValidator.*.nupkg
name: PeselValidator_nuget_package
deploy:
- provider: NuGet
api_key:
secure: PD9Xp/1NegkIddToIeNjDPK9kcW61NTCbbBkz3/7qzu+TeitoPDuB6yuLRh21I1g
artifact: PeselValidator_nuget_package
on:
branch: master
notifications:
- provider: GitHubPullRequest
on_build_success: true
on_build_failure: true
on_build_status_changed: false