This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
circle.yml
522 lines (518 loc) · 18.7 KB
/
circle.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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
version: 2.1
#
# This CI configuration heavily relies on templates and CMake. Most of the
# jobs will have the following steps (usually configurable via parameters):
# prepare, build and test.
#
# 'sanity-checks' and 'baselines' are special. The former will run a series
# of checks to see if the patch has the minimum requirements for landing in
# our repository and the latter will generate new baselines for the tests
# in case the PR changes the baselines.
#
workflows:
version: 2
development:
jobs:
- sanity-checks
- build-template:
name: android-armeabi-v7a-release
executor_name: ubuntu-eoan
target_is_android: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_TOOLCHAIN_FILE=/opt/android/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_CCACHE=/usr/bin/ccache -DANDROID_ABI=armeabi-v7a'
install: true
- build-template:
name: android-arm64-v8a-release
executor_name: ubuntu-eoan
target_is_android: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_TOOLCHAIN_FILE=/opt/android/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_CCACHE=/usr/bin/ccache -DANDROID_ABI=arm64-v8a'
build_params: '--target libmbgl-render-test-runner.so'
install: true
- build-template:
name: android-x86-release
executor_name: ubuntu-eoan
target_is_android: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_TOOLCHAIN_FILE=/opt/android/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_CCACHE=/usr/bin/ccache -DANDROID_ABI=x86'
build_params: '--target libmbgl-render-test-runner.so'
install: true
- build-template:
name: android-x86_64-release
executor_name: ubuntu-eoan
target_is_android: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_TOOLCHAIN_FILE=/opt/android/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_CCACHE=/usr/bin/ccache -DANDROID_ABI=x86_64'
build_params: '--target libmbgl-render-test-runner.so'
install: true
- build-template:
name: linux-gcc8-release
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'
install: true
metrics: true
style_tests: true
- build-template:
name: linux-gcc5-release
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- linux-gcc8-release
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5'
build_params: '--target mbgl-glfw'
test_params: '-N -Q'
- build-template:
name: linux-gcc8-debug-coverage
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- linux-gcc8-release
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_COVERAGE=ON'
style_tests: true
upload_coverage: true
- build-template:
name: linux-clang8-release
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8'
install: true
metrics: true
style_tests: true
- build-template:
name: FIXME-linux-asan
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DMBGL_WITH_SANITIZER=address'
test_params: '|| true'
style_tests: true
- build-template:
name: linux-tsan
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DMBGL_WITH_SANITIZER=thread'
style_tests: true
- build-template:
name: FIXME-linux-valgrind
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS=-DSANITIZE'
test_params: '-j 4 -E "mbgl-node|gl-benchmark" -D ExperimentalMemCheck || true'
- build-template:
name: linux-ubsan
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DMBGL_WITH_SANITIZER=undefined'
style_tests: true
- build-template:
name: qt5-linux-gcc5-release
executor_name: ubuntu-eoan
target_is_linux: true
requires:
- sanity-checks
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 -DMBGL_WITH_QT=ON'
- build-template:
name: qt5-macos-gcc5-release
executor_name: macos-11_1_0
target_is_macos: true
requires:
- linux-gcc8-release
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMBGL_WITH_QT=ON -DCMAKE_PREFIX_PATH=$(echo /usr/local/Cellar/qt/5.*/lib/cmake)'
- build-template:
name: macos-xcode11-release
executor_name: macos-11_1_0
target_is_macos: true
requires:
- linux-gcc8-release
config_params: '-G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/workspace/install/$CIRCLE_JOB -DCMAKE_CXX_COMPILER_LAUNCHER=ccache'
install: true
metrics: true
style_tests: true
- build-template:
name: macos-xcode11-debug
executor_name: macos-11_1_0
target_is_macos: true
requires:
- macos-xcode11-release
config_params: '-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_COVERAGE=ON'
style_tests: true
upload_coverage: true
- build-template:
name: ios-xcode11-release
executor_name: macos-11_3_1
target_is_macos: true
requires:
- linux-gcc8-release
config_params: '-G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64e -DCMAKE_OSX_SYSROOT=iphoneos -DMBGL_WITH_IOS_CCACHE=ON'
build_params: '--config Release'
- baselines:
requires:
- android-arm64-v8a-release
- android-armeabi-v7a-release
- android-x86-release
- android-x86_64-release
- linux-clang8-release
- linux-gcc8-release
- macos-xcode11-release
- trigger-pipeline:
requires:
- baselines
name: mapboxci
slug: mapbox/mapbox-gl-native-internal
- android-api-breakage:
requires:
- baselines
#
# Executors: we currently support two executors, one based on Ubuntu 19.04 aka Disco
# and another based on macOS + Xcode 11.1.0. The Ubuntu executor is a lot more stable
# and will produce reproduceable builds completely offline because it uses a docker
# image with all the build dependencies preinstalled, whereas the macOS is managed
# by CircleCI and will install dependencies on build time. Build results from the macOS
# bots might differ if in meantime the macOS image gets updated. :-(
#
executors:
ubuntu-eoan:
docker:
# FIXME: Move the image to mbgl/
- image: tmpsantos/mbgl_ci:1.9
resource_class: xlarge
working_directory: /src
environment:
DISPLAY: :99
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1
ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:halt_on_error=0
QT_INSTALL_DOCS: /usr/share/qt5/doc
QT_VERSION: 5
TSAN_OPTIONS: suppressions=/src/platform/linux/tsan_suppress.txt
macos-11_1_0:
macos:
xcode: '11.1.0'
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
macos-11_3_1:
macos:
xcode: '11.3.1'
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
commands:
prepare:
steps:
- restore_cache:
keys:
- 'ccache-v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}'
- 'ccache-v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-'
- 'ccache-v1-{{ .Environment.CIRCLE_JOB }}-master'
- run:
name: Prepare
command: |
git submodule sync
git submodule update --init --recursive
git gc
npm install --ignore-scripts
ulimit -c unlimited
prepare-linux:
steps:
- run:
name: Prepare Linux
background: true
command: |
Xvfb :99 -noreset -screen 0 1280x1024x24
prepare-macos:
steps:
- run:
name: Prepare macOS
command: |
brew install cmake ccache glfw ninja pkgconfig qt chargepoint/xcparse/xcparse
brew cask install google-cloud-sdk
pip install ansi2html scipy
config:
parameters:
config_params:
type: string
steps:
- run:
name: Configure
command: |
cmake . -B build << parameters.config_params >>
build:
parameters:
build_params:
type: string
steps:
- run:
name: Build
command: |
ccache --zero-stats --max-size=2G
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null) << parameters.build_params >>
ccache --show-stats
install:
steps:
- run:
name: Install
command: |
cmake --build build --target install/strip
test:
parameters:
test_params:
type: string
steps:
- run:
name: Test
command: |
cd build
ctest -V << parameters.test_params >>
metrics:
parameters:
step_name:
type: string
metrics_params:
type: string
steps:
- run:
name: << parameters.step_name >>
command: |
build/mbgl-render-test-runner << parameters.metrics_params >>
save:
steps:
- save_cache:
key: 'ccache-v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}'
paths:
- .git/modules
- /Users/distiller/Library/Caches/Homebrew
- node_modules
- ~/.ccache
- ~/.gradle
- run:
name: Collecting results
when: always
command: |
mkdir -p /tmp/workspace/metrics && touch /tmp/workspace/.$CIRCLE_JOB
if [ -d metrics/$CIRCLE_JOB ]; then cp -r metrics/$CIRCLE_JOB /tmp/workspace/metrics; fi
mkdir -p /tmp/tests/baselines
if [ -f baselines.patch ]; then cp baselines.patch /tmp/tests/baselines; fi
mkdir -p /tmp/tests/nitpick
if [ -f nitpick.patch ]; then cp nitpick.patch /tmp/tests/nitpick; fi
mkdir -p /tmp/tests/render
if [ -f clang-tidy.log ]; then cp clang-tidy.log /tmp/tests/clang-tidy; fi
mkdir -p /tmp/tests/render
if ls render-test/*.html 1> /dev/null 2>&1; then cp render-test/*.html /tmp/tests/render; fi
mkdir -p /tmp/tests/metrics
if ls metrics/*.html 1> /dev/null 2>&1; then cp metrics/*.html /tmp/tests/metrics; fi
mkdir -p /tmp/tests/coredumps
if ls core* 1> /dev/null 2>&1; then cp core* /tmp/tests/coredumps; fi
mkdir -p /tmp/tests/valgrind
if ls build/Testing/Temporary/MemoryChecker.*.log 1> /dev/null 2>&1; then cp build/Testing/Temporary/MemoryChecker.*.log /tmp/tests/valgrind; fi
- persist_to_workspace:
root: /tmp/workspace
paths:
- '*'
- store_artifacts:
path: /tmp/tests
destination: tests
upload-coverage-results:
steps:
- run:
name: Get coverage results
command: |
cd build
find . -type f -iname *.gcda -exec gcov -p -b {} \;
publish-coverage-metrics:
steps:
- run:
name: Upload coverage metrics to s3
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
scripts/publish_core_codecoverage.js -p Linux -s Core
fi
jobs:
android-api-breakage:
executor: ubuntu-eoan
steps:
- run:
name: Clone mapbox-gl-native-android in working directory
command: git clone https://github.com/mapbox/mapbox-gl-native-android.git .
- prepare
- run:
name: Update mapbox-gl-native to match PR
command: cd vendor/mapbox-gl-native && git fetch origin $CIRCLE_SHA1 && git checkout $CIRCLE_SHA1 && git submodule update --init --recursive
- run:
name: Build SDK
command: BUILDTYPE=Release make android-arm-v8
- save
trigger-pipeline:
executor: ubuntu-eoan
parameters:
slug:
type: string
steps:
- checkout
- run:
name: Trigger Pipeline
command: |
scripts/ci-circleci-start-pipeline.py --target-slug << parameters.slug >>
sanity-checks:
executor: ubuntu-eoan
steps:
- checkout
- prepare
- config:
config_params: '-G Ninja -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8'
- run:
name: Code Generators
command: |
cp build/mbgl-core.license LICENSE.mbgl-core.md
platform/default/include/mbgl/storage/offline_schema.js
scripts/generate-shaders.js
scripts/generate-style-code.js
git add -A && git diff --staged --exit-code | tee nitpick.patch
- run:
name: Validation Scripts
command: |
scripts/nitpick/submodule-pin.js
- run:
name: CMake Format
command: |
cmake-format -i $(find -name '*.cmake' -and -not -path './vendor/*/*' -and -not -path './build/*')
cmake-format -i $(find -name CMakeLists.txt -and -not -path './vendor/*/*' -and -not -path './build/*')
git diff --exit-code | tee nitpick.patch
- run:
name: Clang Format
command: |
git diff -U0 --ignore-submodules=all --no-color origin/master... *.cpp *.hpp | clang-format-diff-8 -p1 -i
git diff --exit-code | tee nitpick.patch
- run:
name: Clang Tidy
command: |
run-clang-tidy-8 -quiet -j $(nproc) -header-filter='.*' -p build $PWD/src/.*cpp $PWD/platform/.*cpp
- save
baselines:
executor: ubuntu-eoan
steps:
- checkout
- prepare
- prepare-linux
- attach_workspace:
at: /tmp/attach
- run:
name: 'Binary Size'
command: |
/tmp/attach/install/linux-gcc8-release/bin/mbgl-render-test-runner -u rebaseline -p metrics/binary-size.json
- run:
name: 'Metrics Baselines'
command: |
cp -r /tmp/attach/metrics .
git add -A && git diff --staged --exit-code | tee baselines.patch
- save
build-template:
parameters:
config_params:
type: string
default: ''
build_params:
type: string
default: ''
test_params:
type: string
default: ''
executor_name:
type: string
target_is_android:
type: boolean
default: false
target_is_linux:
type: boolean
default: false
target_is_macos:
type: boolean
default: false
install:
type: boolean
default: false
metrics:
type: boolean
default: false
style_tests:
type: boolean
default: false
upload_coverage:
type: boolean
default: false
publish_coverage:
type: boolean
default: false
executor: << parameters.executor_name >>
steps:
- checkout
- when:
condition: << parameters.target_is_android >>
steps:
- prepare
- config:
config_params: << parameters.config_params >>
- build:
build_params: << parameters.build_params >>
- when:
condition: << parameters.target_is_linux >>
steps:
- prepare
- prepare-linux
- config:
config_params: << parameters.config_params >>
- build:
build_params: << parameters.build_params >>
- test:
test_params: << parameters.test_params >>
- when:
condition: << parameters.target_is_macos >>
steps:
- prepare
- prepare-macos
- config:
config_params: << parameters.config_params >>
- build:
build_params: << parameters.build_params >>
- test:
test_params: << parameters.test_params >>
- when:
condition: << parameters.install >>
steps:
- install
- when:
condition: << parameters.style_tests >>
steps:
- metrics:
step_name: 'Style Tests'
metrics_params: '-u rebaseline -p metrics/$CIRCLE_JOB-style.json'
- when:
condition: << parameters.metrics >>
steps:
- metrics:
step_name: 'Metrics'
metrics_params: '-u rebaseline -p metrics/$CIRCLE_JOB-metrics.json'
- when:
condition: << parameters.upload_coverage >>
steps:
- upload-coverage-results
- when:
condition: << parameters.publish_coverage >>
steps:
- publish-coverage-metrics
- save