-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
appveyor.yml
212 lines (182 loc) · 6.75 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
version: '0.0.{build}'
image: Visual Studio 2019
# Setup environment
nuget:
disable_publish_on_pr: true
pull_requests:
do_not_increment_build_number: true
branches:
except:
- /tmp|temp/
skip_commits:
files:
- .github/
- .gitattributes
- .gitignore
- LICENSE
- README.md
- CONTRIBUTING.md
- ISSUE_TEMPLATE.md
- CODE_OF_CONDUCT.md
- '**/*.DotSettings'
environment:
SONARQUBE_TOKEN:
secure: 3wp08w0E7dvLNXiVvmxU0KaeMvr8sAFNSoiaTGV/yZBND0dgJ18NbFJnwtwe09vM
DocFXVersion: 2.58
NUnitConsoleVersion: 3.10.0
OpenCoverVersion: 4.7.922
CoverallsVersion: 1.0.0
COVERALLS_REPO_TOKEN:
secure: UXj7LMvcwlRWY+UFiqS6Pqbs8vZjZbDaCMYIwk9YPXcOFbDK8io7lH6/1s0D1uOO
GITHUB_ACCESS_TOKEN:
secure: fLTTmcGOM55kigJC4vErpObFmybCtzQtwb4QN55BTNq3GDGaOCoHDoIPxexzO59d
GITHUB_EMAIL:
secure: wcfqCHOmeRLZf/BX6u6qQSV89Q4jFs9fHNDgMpKAcqE=
# Setup build version
install:
- ps: ./build/setupBuild.ps1
# Assembly infos & csproj patching
assembly_info:
patch: true
file: '**\\AssemblyInfo.*'
assembly_version: '$(Build_Assembly_Version)'
assembly_file_version: '$(Build_Assembly_Version)'
assembly_informational_version: '$(Build_Version)'
dotnet_csproj:
patch: true
file: '**\*.csproj'
version: '$(Build_Assembly_Version)'
package_version: '$(Build_Version)'
assembly_version: '$(Build_Assembly_Version)'
file_version: '$(Build_Assembly_Version)'
informational_version: '$(Build_Version)'
# Build configurations
platform:
- Any CPU
configuration:
- Debug
- Release
matrix:
fast_finish: true
# Build
before_build:
# NuGet restore
- nuget restore -verbosity detailed
# SonarQube
- ps: >-
if ($env:IsFullIntegrationBuild -eq $true)
{
dotnet tool install --tool-path tools dotnet-sonarscanner
$sonarScanner = (Resolve-Path "tools\dotnet-sonarscanner.exe").ToString()
}
build:
verbosity: minimal
build_script:
# Start SonarQube analysis (only for Release configuration)
- ps: $analysisFile = (Convert-Path SonarQube.Analysis.xml).ToString()
- ps: >-
if ($env:IsFullIntegrationBuild -eq $true)
{
& $sonarScanner begin /k:"graphshape" /s:$analysisFile /o:"kernelith-github" /d:sonar.host.url="https://sonarcloud.io" /d:"sonar.branch.name=$env:APPVEYOR_REPO_BRANCH" /d:sonar.cs.opencover.reportsPaths="coverage.xml" /d:sonar.login="$env:SONARQUBE_TOKEN"
}
- msbuild
before_test:
# NuGet packages for test & coverage
- ps: >-
nuget install NUnit.Console -Version $env:NUnitConsoleVersion -OutputDirectory tools
if ($env:IsFullIntegrationBuild -eq $true)
{
nuget install OpenCover -Version $env:OpenCoverVersion -OutputDirectory tools
dotnet tool install --tool-path tools --version $env:CoverallsVersion coveralls.net
}
test_script:
# Test & generate coverage report
- ps: >-
$nunitFolder = (Resolve-Path "tools\NUnit.ConsoleRunner.*\tools").ToString();
$nunitConsole = (Resolve-Path "$nunitFolder\nunit3-console.exe").ToString();
# Only take test assemblies matching their folder name
# Example:
# Directory = tests\TestProject.Tests\bin\CONFIGURATION\TARGET
# Directory.Parent = tests\TestProject.Tests\bin\CONFIGURATION
# Directory.Parent.Parent = tests\TestProject.Tests\bin
# Directory.Parent.Parent.Parent = tests\TestProject.Tests
$testAssemblies = (ls tests\*.Tests\bin\$env:Configuration\net45\*Tests.dll | Where-Object { $_ -Match "net*" -and $_ -NotMatch "netcoreapp*" -and [System.IO.Path]::GetFileNameWithoutExtension($_.FullName) -Match $_.Directory.Parent.Parent.Parent.Name } | % FullName | sort-object -Unique);
$testsPassed = $false;
if ($env:IsFullIntegrationBuild -eq $true)
{
$opencover = (Resolve-Path "tools\OpenCover.*\tools\OpenCover.Console.exe").ToString();
$coveralls = (Resolve-Path "tools\csmacnz.Coveralls.exe").ToString();
& $opencover -register:Path64 -filter:"+[*]* -[*.Test*]* -[*]JetBrains.Annotations*" -excludebyfile:"*\GraphShape.Factory\*;*\GraphShape.Controls\Behaviors\*;*\GraphShape.Controls\Controls\*;*\GraphShape.Controls\*\TransitionExtensions.cs" -hideskipped:File -target:"$nunitConsole" -targetargs:"$testAssemblies --result=\`"TestResult.xml\`"" -returntargetcode -log:Warn -output:coverage.xml;
$testsPassed = $?;
& $sonarScanner end /d:"sonar.login=$env:SONARQUBE_TOKEN"
& $coveralls --opencover -i coverage.xml --repoToken $env:COVERALLS_REPO_TOKEN --useRelativePaths --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage $env:APPVEYOR_REPO_COMMIT_MESSAGE --jobId $env:APPVEYOR_BUILD_NUMBER --serviceName appveyor
}
else
{
& $nunitConsole $testAssemblies;
$testsPassed = $?;
}
# Upload results to AppVeyor
$wc = New-Object 'System.Net.WebClient';
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResult.xml));
if (!$testsPassed)
{
throw "Unit tests failed";
}
after_test:
- ps: ./build/packageSamples.ps1
# Artifacts
artifacts:
- path: '**\bin\Release\*.nupkg'
name: NuGet
- path: '**\bin\Release\*.snupkg'
name: NuGet symbols
- path: '**\bin\Release\*.zip'
name: Samples
# Documentation
before_deploy:
# Release documentation
- ps: ./build/releaseDoc.ps1
# Deploy
deploy:
# MyGet
- provider: NuGet
server: https://www.myget.org/F/kernelith-ci/api/v2/package
symbol_server: https://www.myget.org/F/kernelith-ci/symbols/api/v2/package
artifact: NuGet, NuGet symbols
api_key:
secure: ANF+joC2B+NahxCFbLPOjNvEAo36F2F4QJu6zLwoIf2I9KwkxKyCSuNxDpLmJmtU
on:
configuration: Release
# GitHub packages
- provider: NuGet
server: https://nuget.pkg.github.com/KeRNeLith/index.json
username: KeRNeLith
api_key:
secure: 6N37NtnuKSzKQXlPOCtPSFJGOvJUdJjPK8LcuWx2PjHs2WVdngenZvYixk6br72b
skip_symbols: true
artifact: NuGet
on:
configuration: Release
APPVEYOR_REPO_TAG: true
# NuGet
- provider: NuGet
artifact: NuGet, NuGet symbols
api_key:
secure: zP8NG9npOCKDveAxWgK3a2Nb95gE5tk08i5ksxQKJpzqg0WsbOsK6vfxUjsjmlM+
on:
configuration: Release
APPVEYOR_REPO_TAG: true
# GitHub
- provider: GitHub
auth_token:
secure: fLTTmcGOM55kigJC4vErpObFmybCtzQtwb4QN55BTNq3GDGaOCoHDoIPxexzO59d
release: '${APPVEYOR_REPO_TAG_NAME}'
description: 'Version ${Release_Name}'
artifact: NuGet, NuGet symbols, Samples
draft: false
prerelease: false
force_update: true
on:
configuration: Release
APPVEYOR_REPO_TAG: true