forked from microsoft/bond
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
375 lines (254 loc) · 12.2 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# fsharp feature branch
-
version: 1.0.{build}
clone_depth: 15
branches:
only:
- fsharp
configuration: Debug
build:
project: fsharp\fsharp.sln
verbosity: minimal
test:
assemblies: fsharp\test\TypeProvider\bin\$(configuration)\BondFsharpUnitTest.dll
# other branches
-
version: 1.0.{build}
clone_depth: 15
skip_commits:
files:
# These files are high-churn, but don't affect the build.
#
# NB: README.md is NOT in this list; the documentation build
# consumes it.
- CHANGELOG.md
# These files are only used by the Linux CI builds and don't affect
# the Windows builds.
- .github/**/*
- .travis.yml
- tools/ci-scripts/linux/**
environment:
global:
STACK_ROOT: "c:\\sr"
BOND_TOKEN:
secure: MdnZ86SpR3+/fVz2u31blV83LH6juiobrvO/l1Ak4zG7ykxtvfUI/Vd4l7etYB4J
# The slowest configurations should come first to help reduce
# overall completion time since we run multiple configurations in
# parallel.
matrix:
# C++ Core build and tests
- BOND_BUILD: C++
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOND_ARCH: 64
BOND_BOOST: "1.61.0"
BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE"
- BOND_BUILD: C#
BOND_OUTPUT: Properties
BOND_CONFIG: Debug
- BOND_BUILD: Doc
- BOND_BUILD: C#
BOND_OUTPUT: Fields
BOND_CONFIG: Fields
- BOND_BUILD: Python
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOND_ARCH: 32
BOND_BOOST: "1.62.0"
BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE"
- BOND_BUILD: Python
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOND_ARCH: 64
BOND_BOOST: "1.63.0"
BOND_CMAKE_FLAGS: "-DBOND_ENABLE_GRPC=FALSE"
# C++ gRPC build and tests
- BOND_BUILD: C++
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOND_ARCH: 64
BOND_BOOST: "1.63.0"
BOND_CMAKE_FLAGS: "-DBOND_SKIP_CORE_TESTS=TRUE;-DBOND_SKIP_GBC_TESTS=TRUE"
install:
# Installing .NET Core needs Windows Update enabled.
- sc config wuauserv start= auto
- net start wuauserv
- ps: >-
if (-not $env:BOND_VS_VERSION)
{
$env:BOND_VS_VERSION = $env:APPVEYOR_BUILD_WORKER_IMAGE
if (-not $env:BOND_VS_VERSION)
{
$env:BOND_VS_VERSION = 'Visual Studio 2015'
}
}
if (($env:BOND_BUILD -eq 'C++') -or ($env:BOND_BUILD -eq 'Python')) {
git submodule update --init thirdparty\rapidjson
# If gRPC is not disabled, init gRPC and its dependencies
if (($env:BOND_BUILD -eq 'C++') -and (-not ($env:BOND_CMAKE_FLAGS -match '-DBOND_ENABLE_GRPC=FALSE'))) {
git submodule update --init --recursive thirdparty\grpc
}
$boostComponents = (
'boost_chrono',
'boost_date_time',
'boost_thread',
'boost_system',
'boost_unit_test_framework')
if ($env:BOND_BUILD -eq 'Python') {
$boostComponents += 'boost_python'
}
$vcToolsetVer = tools\ci-scripts\windows\ConvertTo-MsvcVersion.ps1 `
-ImageName $env:BOND_VS_VERSION `
-Format VcToolSetVer
$boostLoc = tools\ci-scripts\windows\Get-BoostLocation.ps1 `
-Version $env:BOND_BOOST `
-VcToolSetVer $vcToolSetVer
if (-not $boostLoc)
{
$boostLoc = tools\ci-scripts\windows\Install-Boost.ps1 `
-Version $env:BOND_BOOST `
-VcToolSetVer $vcToolSetVer `
-Components $boostComponents
}
if ((-not $boostLoc) -or (-not $boostLoc['BOOST_LIBRARYDIR'][$env:BOND_ARCH]))
{
throw "No Boost libraries found/installed for $env:BOND_BOOST $env:BOND_ARCH"
}
$env:BOOST_ROOT = $boostLoc['BOOST_ROOT']
$env:BOOST_LIBRARYDIR = $boostLoc['BOOST_LIBRARYDIR'][$env:BOND_ARCH]
}
choco install haskell-stack -y
# temp workaround: install ghc for happy install
choco install ghc --version 8.0.1 -y
choco install dotnetcore-sdk -y
# choco install updated the path, so re-read them from the registry and reset $env:path
$machinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$userPath = [System.Environment]::GetEnvironmentVariable("Path","User")
$env:Path = "$machinePath;$userPath"
# temp workaround: run cabal update and install happy
cabal update
cabal install happy-1.19.5
if ($env:BOND_BUILD -eq "Doc") {
choco install pandoc --version 1.19.2 -y
choco install doxygen.install -y
$machinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$userPath = [System.Environment]::GetEnvironmentVariable("Path","User")
$env:Path = "$machinePath;$userPath"
$env:Path += "C:\Program Files\doxygen\bin"
Get-Command doxygen,pandoc
}
if (($env:BOND_BUILD -eq 'C++') -and (-not ($env:BOND_CMAKE_FLAGS -match '-DBOND_ENABLE_GRPC=FALSE'))) {
# We're building C++ and gRPC isn't disabled, so we need
# gRPC dependencies.
choco install yasm -y
$machinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$userPath = [System.Environment]::GetEnvironmentVariable("Path","User")
$env:Path = "$machinePath;$userPath"
}
cache:
- cs\packages -> cs\test\core\packages.config
- "c:\\sr"
before_build:
- ps: >-
$env:PreferredToolArchitecture = "x64"
$env:_IsNativeEnvironment = "true"
$vsCmakeGeneratorNum = tools\ci-scripts\windows\ConvertTo-MsvcVersion.ps1 `
-ImageName $env:BOND_VS_VERSION `
-Format CMakeGeneratorNum
$vsYear = tools\ci-scripts\windows\ConvertTo-MsvcVersion.ps1 `
-ImageName $env:BOND_VS_VERSION `
-Format Year
$cmakeGenerator = "Visual Studio $vsCmakeGeneratorNum $vsYear"
if ($env:BOND_ARCH -eq 64) {
$cmakeGenerator += " Win64"
}
$cmakeFlags = $env:BOND_CMAKE_FLAGS -split ';'
if ($env:BOND_BUILD -eq "C#" -Or $env:BOND_BUILD -eq "C++") {
dotnet restore cs\cs.sln
}
if ($env:BOND_BUILD -eq "Python" -Or $env:BOND_BUILD -eq "C++") {
# Make sure we have Python27-64 before any other version
$env:Path = "C:\Python27\;${env:Path}"
if ($env:BOND_ARCH -eq 64) {
$env:Path = "C:\Python27-x64\scripts;C:\Python27-x64\;${env:Path}"
}
}
if ($env:BOND_ARCH -eq 64) {
$pythonExt = "-x64"
}
if ($env:BOND_BUILD -eq "Python") {
mkdir build
cd build
cmake "-DBoost_ADDITIONAL_VERSIONS=${env:BOND_BOOST}" "-DPYTHON_EXECUTABLE:FILEPATH=C:\Python27${pythonExt}\python.exe" $cmakeFlags -G $cmakeGenerator ..
}
if ($env:BOND_BUILD -eq "C++") {
# We don't always need all of these compat tests--depending
# on what part of C++ we're building--but they're pretty
# fast to build, so build them all.
$compatTests = ('Tests\Compat', 'Tests\GrpcCompatClient', 'Tests\GrpcCompatServer')
dotnet msbuild cs\cs.sln /verbosity:minimal "/target:$($compatTests -join ';')"
if (-not $?) { throw "cs compat build failed" }
mkdir build
cd build
cmake "-DPYTHON_EXECUTABLE:FILEPATH=C:\Python27${pythonExt}\python.exe" $cmakeFlags -G $cmakeGenerator .. 2>cmake_stderr.log
Get-Content cmake_stderr.log
}
if ($env:BOND_BUILD -eq "Doc") {
mkdir build
cd build
cmake ../doc
}
build_script:
- ps: >-
$env:PreferredToolArchitecture = "x64"
$env:_IsNativeEnvironment = "true"
if ($env:BOND_BUILD -eq "Doc") {
cmake --build . --target documentation -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
if (($LASTEXITCODE -eq 0) -And ($env:BOND_TOKEN) -And ($env:APPVEYOR_REPO_BRANCH -eq "master")) {
git config --global user.email "bondlab@microsoft.com"
git config --global user.name "Appveyor"
git clone -b gh-pages "https://${env:BOND_TOKEN}@github.com/microsoft/bond.git" gh-pages 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) { throw "Cloning gh-pages branch failed: $LASTEXITCODE" }
cd gh-pages
robocopy ..\html . /E /J /MIR /MT /NFL /XD .git 2>&1
# Robocopy uses exit codes 0-7 to convey details about
# what was copied. Exit code 8 starts the range of
# errors.
if ($LASTEXITCODE -ge 8) { throw "Robocopy documentation failed: $LASTEXITCODE" }
git add --all .
if ($LASTEXITCODE -ne 0) { throw "git add failed: $LASTEXITCODE" }
# Don't test exit code of 'git commit'. When there is
# nothing to commit, it exits with 1. The push below
# should still exit with 0 after not doing anything, so
# the build will still pass.
git commit -m "Update documentation"
git push origin gh-pages 2>&1 | out-null
if ($LASTEXITCODE -ne 0) { throw "git push failed: $LASTEXITCODE" }
cd ..
}
}
if ($env:BOND_BUILD -eq "Python") {
cmake --build . --target python_unit_test -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
}
if ($env:BOND_BUILD -eq "C++") {
cmake --build . --target check -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
}
if ($env:BOND_BUILD -eq "C#") {
dotnet msbuild cs\cs.sln /verbosity:minimal /p:Configuration=${env:BOND_CONFIG}
}
if (-not $?) { throw "build failed" }
test_script:
- ps: >-
if ($env:BOND_BUILD -eq "Python") {
ctest -C Debug --tests-regex python_unit_test --output-on-failure
if (-not $?) { throw "tests failed" }
}
if ($env:BOND_BUILD -eq "C#") {
dotnet test cs\test\core\Core.csproj
if (-not $?) { throw "tests failed" }
dotnet test cs\test\coreNS10\CoreNS10.csproj
if (-not $?) { throw "tests failed" }
dotnet test cs\test\internal\Internal.csproj
if (-not $?) { throw "tests failed" }
dotnet test cs\test\grpc\grpc.csproj
if (-not $?) { throw "tests failed" }
& cs\test\test-examples.ps1 -IgnorePatterns '*\shared-types-assembly\*' -ErrorVariable exampleErrors
if ($exampleErrors) { throw "One or more example failed. See above for details." }
}
if (-not $?) { throw "build failed" }