-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
317 lines (312 loc) · 13.3 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
version: 2
workflows:
version: 2
default:
jobs:
- build
- build-1.0
- release
- release-1.0
- ui-tests
- publish:
filters:
tags:
only: /^testapp-.*/
branches:
ignore: /.*/
jobs:
build:
working_directory: ~/code
docker:
- image: mbgl/61abee1674:android-ndk-r18
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false
steps:
- checkout
- restore_cache:
keys:
- jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- jars-
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Generate and Validate License
command: |
make license-verification
- run:
name: Check Java code style
command: make checkstyle
- run:
name: Check Kotlin code style
command: ./gradlew ktlint
- run:
name: Run unit-test, generate Jacoco test report and Post code coverage report to Codecov.io
command: |
./gradlew testDebugUnitTestCoverage
pip install --user codecov && /root/.local/bin/codecov
- run:
name: Build release to test ProGuard rules
command: ./gradlew app:assembleRelease
- run:
name: Build Test Application APK
command: |
./gradlew accessToken
./gradlew app:assembleDebug
- run:
name: Build Instrumentation Test APK
command: |
./gradlew app:assembleAndroidTest
- run:
name: Log in to Google Cloud Platform
shell: /bin/bash -euo pipefail
command: |
echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
gcloud auth activate-service-account --key-file secret.json --project mapbox-navigation-android
rm secret.json
# - run:
# name: Run instrumentation tests on Firebase
# no_output_timeout: 1200
# shell: /bin/bash -euo pipefail
# command: |
# gcloud firebase test android run --type instrumentation \
# --app app/build/outputs/apk/debug/app-debug.apk \
# --test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
# --device model=hammerhead,version=21,locale=en,orientation=portrait \
# --device model=athene,version=23,locale=fr,orientation=landscape \
# --device model=sailfish,version=26,locale=es,orientation=portrait \
# --device model=walleye,version=28,locale=de,orientation=landscape \
# --timeout 5m
# - run:
# name: Run robo test on Firebase
# no_output_timeout: 1200
# shell: /bin/bash -euo pipefail
# command: |
# gcloud firebase test android run --type robo \
# --app app/build/outputs/apk/debug/app-debug.apk \
# --device-ids shamu \
# --os-version-ids 22 \
# --locales en \
# --orientations portrait \
# --timeout 5m
- run:
name: Update Transifex
command: |
if [ "${CIRCLE_BRANCH}" == "${DEPLOY_BRANCH}" ]; then
pip install transifex-client
echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = '"${TRANSIFEX_USER}"$'\npassword = '"${TRANSIFEX_API_TOKEN}"$'\ntoken = '""$'\n' > ~/.transifexrc
tx push -s
else
echo "Skipping push to Transifex"
fi
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
build-1.0:
working_directory: ~/code
docker:
- image: mbgl/61abee1674:android-ndk-r18
steps:
- checkout
- restore_cache:
keys:
- deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "libdirections-hybrid/build.gradle" }}-{{ checksum "libdirections-offboard/build.gradle" }}-{{ checksum "libdirections-onboard/build.gradle" }}-{{ checksum "liblogger/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}
- deps-
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "libdirections-hybrid/build.gradle" }}-{{ checksum "libdirections-offboard/build.gradle" }}-{{ checksum "libdirections-onboard/build.gradle" }}-{{ checksum "liblogger/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}
- run:
name: Check Kotlin code style
command: ./gradlew ktlint
- run:
name: Build Navigation SDK 1.0 (debug)
command: make 1.0-build-debug
- run:
name: Run unit-test
command: make 1.0-unit-tests
ui-tests:
docker:
- image: mbgl/61abee1674:android-ndk-r18
working_directory: ~/code
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
steps:
- checkout
- restore_cache:
keys:
- deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "examples/build.gradle" }}-{{ checksum "libdirections-hybrid/build.gradle" }}-{{ checksum "libdirections-offboard/build.gradle" }}-{{ checksum "libdirections-onboard/build.gradle" }}-{{ checksum "liblogger/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}
- deps-
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "examples/build.gradle" }}-{{ checksum "libdirections-hybrid/build.gradle" }}-{{ checksum "libdirections-offboard/build.gradle" }}-{{ checksum "libdirections-onboard/build.gradle" }}-{{ checksum "liblogger/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}
- run:
name: Export secrets for developer-config.xml
command: |
#!/bin/bash
echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/app/src/main/res/values/developer-config.xml
echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/examples/src/main/res/values/developer-config.xml
- run:
name: Build Test Application APK
command: ./gradlew examples:assembleDebug
- run:
name: Build Instrumentation Test APK
command: ./gradlew examples:assembleAndroidTest
- run:
name: Log in to Google Cloud Platform
shell: /bin/bash -euo pipefail
command: |
echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
gcloud auth activate-service-account --key-file secret.json --project mapbox-navigation-android
rm secret.json
- run:
name: Run instrumentation tests on Firebase
no_output_timeout: 1200
shell: /bin/bash -euo pipefail
command: |
gcloud firebase test android run --type instrumentation \
--app examples/build/outputs/apk/debug/examples-debug.apk \
--test examples/build/outputs/apk/androidTest/debug/examples-debug-androidTest.apk \
--device model=hammerhead,version=21,locale=en,orientation=portrait \
--device model=athene,version=23,locale=fr,orientation=landscape \
--device model=sailfish,version=26,locale=es,orientation=portrait \
--device model=walleye,version=28,locale=de,orientation=landscape \
--timeout 5m
# ------------------------------------------------------------------------------
release:
branch:
only:
- master
docker:
- image: mbgl/61abee1674:android-ndk-r18
working_directory: ~/code
environment:
BUILDTYPE: Release
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- run:
name: Generate and Validate License
command: |
make license-verification
- run:
name: Generate Maven credentials
shell: /bin/bash -euo pipefail
command: |
aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg secring.gpg
echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME
NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD
signing.keyId=$SIGNING_KEYID
signing.password=$SIGNING_PASSWORD
signing.secretKeyRingFile=../secring.gpg" >> gradle.properties
- run:
name: Build Navigation SDK
command: make build-release
- deploy:
name: Publish Navigation SDK To Maven Central
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
make publish ;
fi
- store_artifacts:
path: app/build/reports
destination: reports
- restore_cache: # special step to restore the dependency cache
keys:
- dependency-cache-{{ checksum "package.json" }}
- dependency-cache-
- run:
name: Setup Environment
command: npm install
- save_cache: # special step to save the dependency cache
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Check & Publish Binary Size
command: |
./scripts/check_binary_size.sh ./scripts/paths_file.txt ./scripts/labels_file.txt 'mapbox-navigation-android' 'android' ./scripts/sdks_file.txt "${CIRCLE_SHA1}"
release-1.0:
working_directory: ~/code
docker:
- image: mbgl/61abee1674:android-ndk-r18
steps:
- checkout
- run:
name: Build Navigation SDK 1.0 (release)
command: make 1.0-build-release
- run:
name: Generate documentation
command: make javadoc-dokka
# Uncomment when API' docs will be ready
# - run:
# name: Check public documentation
# command: sh scripts/dokka-validate.sh
- deploy:
name: Publish Navigation SDK 1.0 to Bintray
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
version=$(cat gradle/artifact-settings.gradle | grep "versionName")
if [[ $version != *"SNAPSHOT"* ]]; then
make 1.0-publish-to-bintray
else
make 1.0-publish-to-artifactory
fi
fi
# ------------------------------------------------------------------------------
publish:
docker:
- image: mbgl/61abee1674:android-ndk-r18
working_directory: ~/code
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
GOOGLE_PLAY_TRACK: internal
steps:
- checkout
- restore_cache:
keys:
- jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- jars-
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Export Google Play authentication json
command: |
#!/bin/bash
echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/app/src/main/res/values/developer-config.xml
echo "${PLAY_PUBLISH_AUTH_JSON}" > android-gl-native-15d95ab30d0f.json
- run:
name: Crashlytics setup
command: |
#!/bin/bash
echo "apply plugin: 'io.fabric'" >> /root/code/app/build.gradle
echo "apply plugin: 'com.google.gms.google-services'" >> /root/code/app/build.gradle
echo "${GOOGLE_SERVICES_JSON}" > /root/code/app/google-services.json
- run:
name: Release to Google Play
command: ./gradlew :app:publishRelease
# ------------------------------------------------------------------------------