forked from mapbox/mapbox-gl-native-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
555 lines (523 loc) · 16.8 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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
version: 2.1
orbs:
# https://circleci.com/orbs/registry/orb/circleci/slack
slack: circleci/slack@3.4.2
workflows:
version: 2
mbgl-legacy:
jobs:
#
# Naming convention: {platform}-{additional description}-{build type}
# - {platform} is the client platform/framework, which may differ from
# the build platform. Specify both if applicable, e.g., "qt5-macos".
# - {additional description} optionally describes the compiler or other
# unique aspect of the build environment.
# - {build type} is typically "debug" or "release".
#
- ios-build:
matrix:
parameters:
xcode: ["11.1.0", "11.7.0"]
buildtype: ["Debug", "Release"]
- ios-release-template:
xcode: "12.0.0"
name: ios-release
# This should depend on sanitize jobs
- ios-release-tag:
xcode: "12.0.0"
# Commenting out to test for release.
# requires:
# - ios-build
# - ios-release
filters:
tags:
only: /ios-.*/
branches:
ignore: /.*/
- ios-trigger-metrics:
requires:
- ios-build
- ios-release
filters:
branches:
only: master
# - macos-debug
nightly:
triggers:
- schedule:
cron: "0 5 * * *"
filters:
branches:
only:
- master
jobs:
- ios-build:
matrix:
parameters:
xcode: ["11.3.1", "11.5.0", "11.6.0", "12.0.0"]
buildtype: ["Debug", "Release"]
- ios-sanitize-nightly:
requires:
- ios-build
# TODO: Add matrix for these
- ios-sanitize-address-nightly:
requires:
- ios-build
- ios-static-analyzer-nightly:
requires:
- ios-build
- metrics-nightly:
requires:
- ios-build
commands:
npm-install:
steps:
- run:
name: npm install
command: npm install --ignore-scripts
prepare-environment:
steps:
- run:
name: Prepare environment
command: touch "$BASH_ENV" && ./scripts/environment.js | tee -a "$BASH_ENV"
prepare-submodules:
steps:
- run:
name: Prepare submodules
command: git submodule sync && git submodule update --init --recursive
prepare-ccache:
steps:
- run:
name: Prepare ccache
command: |
# CircleCI doesn't have any way to embed arbitrary environment variables or command output
# into cache keys, so we're using the workaround of writing the desired content to a file,
# and then using `{{ checksum "filename" }}` in the cache key.
echo "$CIRCLE_BRANCH"
echo "$CIRCLE_BRANCH" > .circle-branch
echo "$CIRCLE_SHA1"
echo "$CIRCLE_SHA1" > .circle-sha1
echo "$CIRCLE_TARGET_BRANCH"
echo "${CIRCLE_TARGET_BRANCH:master}" > .circle-target-branch
echo "$CIRCLE_MERGE_BASE"
echo "${CIRCLE_MERGE_BASE:master}" > .circle-merge-base
ccache --clear
reset-ccache-stats:
steps:
- run:
name: Clear ccache statistics
command: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
show-ccache-stats:
steps:
- run:
name: Show ccache statistics
command: ccache --show-stats
save-node_modules-cache:
steps:
- save_cache:
name: Save node_modules cache
key: 'node_modules/v1/{{ arch }}/{{ checksum "package.json" }}'
paths: [ "node_modules" ]
restore-node_modules-cache:
steps:
- restore_cache:
name: Restore node_modules cache
keys:
- 'node_modules/v1/{{ arch }}/{{ checksum "package.json" }}'
- 'node_modules/v1/{{ arch }}'
save-ccache:
steps:
- save_cache:
name: Save ccache
key: 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}/{{ checksum ".circle-sha1" }}'
paths: [ "~/.ccache" ]
restore-ccache:
steps:
- restore_cache:
name: Restore ccache
keys:
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}/{{ checksum ".circle-sha1" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-target-branch" }}/{{ checksum ".circle-merge-base" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-target-branch" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}'
install-dependencies:
parameters:
node_modules:
type: boolean
default: true
ccache:
type: boolean
default: true
steps:
- checkout
- prepare-submodules
- when:
condition: << parameters.node_modules >>
steps: [ restore-node_modules-cache, npm-install ]
- prepare-environment
- when:
condition: << parameters.ccache >>
steps: [ prepare-ccache, restore-ccache, reset-ccache-stats ]
save-dependencies:
parameters:
node_modules:
type: boolean
default: true
ccache:
type: boolean
default: true
steps:
- when:
condition: << parameters.node_modules >>
steps: [ save-node_modules-cache ]
- when:
condition: << parameters.ccache >>
steps: [ save-ccache, show-ccache-stats ]
configure-cmake:
steps:
- run:
name: CMake configuration step
command: |
mkdir -p build
cd build
cmake -DWITH_COVERAGE=${WITH_COVERAGE:0} -DWITH_OSMESA=${WITH_OSMESA:0} -DWITH_EGL=${WITH_EGL:0} ..
cd ..
build-ios-test:
steps:
- run:
name: Build ios-test
command: make ios-test
no_output_timeout: 20m
build-ios-integration-test:
steps:
- run:
name: Build ios-integration-test
command: make ios-integration-test
build-macos-test:
steps:
- run:
name: Build macos-test
command: make macos-test
no_output_timeout: 20m
check-public-symbols:
steps:
- run:
name: Check public symbols
command: make darwin-check-public-symbols
install-ios-packaging-dependencies:
steps:
- run:
name: Install iOS packaging dependencies
command: |
echo "ruby-2.6" > ~/.ruby-version
./platform/ios/scripts/install-packaging-dependencies.sh
background: true
install-macos-dependencies:
steps:
- run:
name: Install macOS dependencies
command: |
brew update && brew upgrade carthage
brew install cmake ccache pkg-config glfw3 github/gh/gh
trigger-metrics:
steps:
- run:
name: Trigger metrics
command: |
if [ -n "${MOBILE_METRICS_TOKEN}" ]; then
bash -c "curl -X POST --header \"Content-Type: application/json\" --data '{\"parameters\": {\"run_ios_maps_benchmark\": true, \"ci_ref\": $CIRCLE_BUILD_NUM }, \"branch\": \"master\" }' https://circleci.com/api/v2/project/github/mapbox/mobile-metrics/pipeline?circle-token=${MOBILE_METRICS_TOKEN}"
else
echo "MOBILE_METRICS_TOKEN not provided"
fi
collect-xcode-build-logs:
steps:
- run:
name: Collect Xcode build logs
when: always
command: |
export XCODE_LOG_DIR=build/logs
mkdir -p $XCODE_LOG_DIR
cp build/*.log $XCODE_LOG_DIR || true
upload-xcode-build-logs:
steps:
- store_artifacts:
path: build/logs
# Must be last step of a job
notify-slack-failure:
steps:
- slack/status:
fail_only: true
only_for_branches: 'internal,master'
include_visit_job_action: true
failure_message: ':red_circle: Job \`$CIRCLE_JOB\` <$CIRCLE_BUILD_URL|failed>.'
#
# Add this step to all regular jobs to enable skipping of certain non-code-related changes.
#
# Do not include this step in nightly or release deployment jobs.
#
# To make a job potentially skippable on changes unrelated to its platform, it must:
# - Target one of the skippable platforms: Android, iOS, or macOS.
# - Have a job name that begins with a supported platform name.
# - Not be related to core functionality or rendering tests. Job names that
# contain "render-tests" cannot be skipped by platform changes.
#
# See the script in the following step for how to implement support for other platforms.
#
check-if-this-job-can-be-skipped:
steps:
- run:
name: Check if this job can be skipped
command: |
if [[ $CIRCLE_BRANCH != master ]] && [[ $CIRCLE_BRANCH != release-* ]] && [[ -z $CIRCLE_TAG ]]; then
scripts/check-ci-job-skippability.js
fi
jobs:
ios-build:
parameters:
xcode:
type: string
buildtype:
type: string
default: Debug
notify-slack:
type: boolean
default: false
macos:
xcode: << parameters.xcode >>
environment:
BUILDTYPE: << parameters.buildtype >>
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-public-symbols
- run:
name: Lint podspecs and plist files
command: make ios-lint
- check-if-this-job-can-be-skipped
- build-ios-test
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- when:
condition: << parameters.notify-slack >>
steps:
- notify-slack-failure
# ------------------------------------------------------------------------------
ios-sanitize-nightly:
macos:
xcode: "11.7.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with thread and undefined behavior sanitizers
command: make ios-sanitize
- run:
name: Get iOS code coverage
command: |
echo "Skipping iOS code coverage"
# Currently failing, need to update for Xcode 11
# platform/ios/scripts/ios-code-coverage.sh CI
#
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-failure
# ------------------------------------------------------------------------------
ios-sanitize-address-nightly:
macos:
xcode: "11.7.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with address sanitizer
command: make ios-sanitize-address
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-failure
# ------------------------------------------------------------------------------
ios-static-analyzer-nightly:
macos:
xcode: "11.7.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with the static analyzer
command: make ios-static-analyzer
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-failure
# # ------------------------------------------------------------------------------
# ios-static-analyzer-nightly-xcode10:
# macos:
# xcode: "10.3.0"
# environment:
# BUILDTYPE: Debug
# HOMEBREW_NO_AUTO_UPDATE: 1
# HOMEBREW_NO_INSTALL_CLEANUP: 1
# steps:
# - install-macos-dependencies
# - install-dependencies
# - run:
# name: Build and run SDK unit tests with the static analyzer
# command: make ios-static-analyzer
# - save-dependencies
# - collect-xcode-build-logs
# - upload-xcode-build-logs
# - notify-slack-failure
# ------------------------------------------------------------------------------
ios-release-template:
parameters:
xcode:
type: string
macos:
xcode: << parameters.xcode >>
shell: /bin/bash --login -eo pipefail
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-if-this-job-can-be-skipped
- install-ios-packaging-dependencies
- run:
name: Build dynamic framework for device and simulator
command: make iframework FORMAT=dynamic BUILD_DEVICE=true BUILD_DOCS=false
no_output_timeout: 20m
- deploy:
name: Upload snapshot build to s3
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
platform/ios/scripts/deploy-snapshot.sh
fi
# - deploy:
# name: Deploy to Mapbox CocoaPods spec repo
# command: |
# if [[ $CIRCLE_BRANCH == master ]]; then
# platform/ios/scripts/deploy-to-cocoapods.sh
# fi
- run:
name: Record size
command: |
echo "Skipping Record size step"
# Skipping due to https://github.com/mapbox/mapbox-gl-native/issues/15751
#platform/ios/scripts/metrics.sh
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-failure
# ------------------------------------------------------------------------------
ios-release-tag:
parameters:
xcode:
type: string
macos:
xcode: << parameters.xcode >>
shell: /bin/bash --login -eo pipefail
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- slack/notify:
message: '<$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` started.>'
include_visit_job_action: true
- install-macos-dependencies
- install-dependencies
- install-ios-packaging-dependencies
- run:
name: Trigger external deploy steps
command: |
export VERSION_TAG=${CIRCLE_TAG}
export DOCS_REPO="ios-sdk"
scripts/trigger-maps-documentation-deploy-steps.sh
- run:
name: Build, package, and upload iOS release
command: |
echo CIRCLE_TAG=${CIRCLE_TAG}
echo CIRCLE_SHA1=${CIRCLE_SHA1}
export VERSION_TAG=${CIRCLE_TAG}
platform/ios/scripts/deploy-packages.sh
no_output_timeout: 20m
# - deploy:
# name: Deploy to CocoaPods
# command: platform/ios/scripts/deploy-to-cocoapods.sh
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
# Must be last step in job
- slack/status:
fail_only: false
include_visit_job_action: true
failure_message: ':red_circle: <$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` failed.>'
success_message: ':green_circle: <$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` succeeded!> :tada:'
# ------------------------------------------------------------------------------
ios-trigger-metrics:
macos:
xcode: "11.7.0"
steps:
- trigger-metrics
# ------------------------------------------------------------------------------
macos-debug:
macos:
xcode: "11.7.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-if-this-job-can-be-skipped
- build-macos-test
- check-public-symbols
- run:
name: Lint plist files
command: make macos-lint
- run:
name: Nitpick Darwin code generation
command: scripts/nitpick/generated-code.js darwin
- save-dependencies
- store_artifacts:
path: test/fixtures
destination: test/fixtures
- collect-xcode-build-logs
- upload-xcode-build-logs
# ------------------------------------------------------------------------------
metrics-nightly:
docker:
- image: mbgl/linux-gcc-5:54f59e3ac5
working_directory: /src
environment:
LIBSYSCONFCPUS: 2
JOBS: 2
steps:
- install-dependencies
- run:
name: Collect GitHub statistics
command: |
scripts/publish_github_stats.js