-
Notifications
You must be signed in to change notification settings - Fork 1
/
appveyor.yml
116 lines (99 loc) · 4.07 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
## https://www.appveyor.com/docs/appveyor-yml/
image: Previous Visual Studio 2022
version: 6.3.{build}
configuration:
- Debug
platform: Any CPU
pull_requests:
do_not_increment_build_number: true
skip_commits:
files:
- CHANGELOG.md
- appveyor.yml
- repository.json
- src/version.json
environment:
# Don't report back to the mothership
DOTNET_CLI_TELEMETRY_OPTOUT: 1
JAVA_HOME: C:\Program Files\Java\jdk19
SONAR_TOKEN:
secure: fNmV/P8zSNwd3LWpzw2nnm807oe1Hr0gr11hTItGCXmnVQ0tHN1ESPUjLYjsXmpG
SONAR_PROJECT: cortside_cortside.domainevent
RESTRICTED_WORDS:
secure: y2oCk9wYmgBAzk4m1tsSFUOlcEePEjozzMCfC0p6NQI=
init:
- ps: $Env:LABEL = "CI" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
- ps: Get-ChildItem "Env:"
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: '{version}'
assembly_file_version: '{version}'
assembly_informational_version: '{version}'
before_build:
- set DNX_BUILD_VERSION=%APPVEYOR_BUILD_NUMBER%
- ps: Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
- ps: ./dotnet-install.ps1 -Channel 8.0 -Runtime aspnetcore -InstallDir 'C:\Program Files\dotnet\'
- ps: ./dotnet-install.ps1 -Channel 8.0 -InstallDir 'C:\Program Files\dotnet\'
- dotnet --info
- ps: ./prebuild.ps1
#- appveyor-retry dotnet restore src -v Minimal
build:
publish_nuget: true
publish_nuget_symbols: true
use_snupkg_format: true
include_nuget_references: true
verbosity: minimal
build_script:
- ps: >-
$version = $env:APPVEYOR_BUILD_VERSION;
$analysisArgs = "";
if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
$branch = $Env:APPVEYOR_REPO_BRANCH;
$analysisArgs = "/d:sonar.branch.name=""$branch""";
if ($branch -ne "master") {
$target = "develop";
if ($branch -eq "develop" -or $branch -like "release/*" -or $branch -like "hotfix/*") {
$target = "master";
}
$analysisArgs += " /d:sonar.newCode.referenceBranch=""$target""";
}
} else {
$branch = $Env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH;
$target = $Env:APPVEYOR_REPO_BRANCH;
$commit = $Env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT;
$pullRequestId = $Env:APPVEYOR_PULL_REQUEST_NUMBER;
$analysisArgs = "/d:sonar.scm.revision=""$commit"" /d:sonar.pullrequest.key=""$pullRequestId"" /d:sonar.pullrequest.base=""$target"" /d:sonar.pullrequest.branch=""$branch""";
}
$env:SOURCE_BRANCH="$branch";
$env:TARGET_BRANCH="$target";
$env:SONAR_ARGUMENTS="$analysisArgs";
echo "building version $version from branch $branch targeting $target with analysis arguments of $analysisArgs";
- dotnet tool install --global dotnet-sonarscanner
- dotnet sonarscanner begin /n:"%SONAR_NAME%" /o:"cortside" /k:"%SONAR_PROJECT%" /v:"%APPVEYOR_BUILD_VERSION%" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="%SONAR_TOKEN%" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" %SONAR_ARGUMENTS%
- dotnet build src --configuration %Configuration% /property:"Version=%APPVEYOR_BUILD_VERSION%"
- dotnet test src --collect:"XPlat Code Coverage" --settings ./src/coverlet.runsettings.xml /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- dotnet sonarscanner end /d:sonar.login="%SONAR_TOKEN%"
after_build:
- ps: >-
$branch = $ENV:APPVEYOR_REPO_BRANCH;
$fileVersion = $env:APPVEYOR_BUILD_VERSION;
if($branch -ne 'master') {
$fileVersion = "${fileVersion}-${branch}";
}
$fileVersion = $fileVersion.replace("release/", "");
$fileVersion = $fileVersion.replace("feature/", "");
$fileVersion = $fileVersion.replace("bugfix/", "");
dotnet pack src --include-symbols -p:SymbolPackageFormat=snupkg --configuration $env:configuration -o ((get-location).Path + '\artifacts') /property:Version=$fileVersion
artifacts:
- path: artifacts\**\*.*
cache:
- '%USERPROFILE%\.nuget\packages'
nuget:
disable_publish_on_pr: true
# account_feed: true
# project_feed: true
deploy:
- provider: NuGet
api_key:
secure: wrXAwgDagNpfLJIY+q0SDdkvCm5gOrnVfzKhL1OS1VVGyO7+gh7GuisLSzFF5v5z