summaryrefslogtreecommitdiff
path: root/platform/android/bitrise.yml
blob: d0be8c015f1f1632d3962e64438238c85537bf0a (plain)
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
---
format_version: 1.0.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
trigger_map:
- pattern: devicefarmUpload
  workflow: devicefarmUpload
- pattern: scheduled
  workflow: scheduled
- pattern: nightly-release
  workflow: nightly-release
- pattern: "*"
  workflow: primary
workflows:
  primary:
    steps:
    - script:
        title: Check for skipping CI
        inputs:
        - content: |-
            #!/bin/bash

            if [[ -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_SUBJECT | sed -n '/\[skip ci\]/p')"  ||
                  -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_SUBJECT | sed -n '/\[ci skip\]/p')"  ||
                  -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_BODY    | sed -n 's/\[skip ci\]/p')" ||
                  -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_BODY    | sed -n 's/\[ci skip\]/p')" ]]; then
                envman add --key SKIPCI --value true
            else
                envman add --key SKIPCI --value false
            fi
    - script:
        title: Configure GL-native build environement
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            set -eu -o pipefail
            curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
            sudo apt-get install -y pkg-config nodejs cmake
    - script:
        title: Run Checkstyle
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            # Run checkstyle gradle task on all modules
            cd platform/android && ./gradlew checkstyle
    - script:
        title: Configure Google Cloud SDK
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            # Install python tools for pip
            sudo apt-get install -y gcc python-dev python-setuptools
            sudo easy_install -U pip
            sudo pip uninstall crcmod
            sudo pip install -U crcmod

            # Install Google Cloud SDK for Firebase
            export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
            echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
            curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
            sudo apt-get update && sudo apt-get install -y google-cloud-sdk

            # Get authentication secret
            echo "Downloading Google Cloud authentication:"
            wget -O secret.json "$BITRISEIO_GCLOUD_SERVICE_ACCOUNT_JSON_URL"
    - script:
        title: Build libmapbox-gl.so for armeabi-v7a
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Compile libmapbox-gl.so for armeabi-v7a abi:"
            export BUILDTYPE=Debug
            make android-lib-arm-v7
    - script:
        title: Compile Core tests
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Compiling core tests:"
            BUILDTYPE=Debug make android-test-lib-arm-v7
    - script:
        title: Run local JVM Unit tests on phone module
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Running unit tests from MapboxGLAndroidSDKTestApp/src/test:"
            make run-android-unit-test
    - script:
        title: Run local JVM Unit tests on wear module
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Running unit tests from MapboxGLAndroidSDKWearTestApp/src/test:"
            make run-android-wear-unit-test
    - script:
        title: Generate Espresso sanity tests
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Generate these test locally by executing:"
            make test-code-android
    - script:
        title: Run Firebase instrumentation tests
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - content: |-
            #!/bin/bash
            echo "Downloading Mapbox accesstoken for running tests:"
            wget -O platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml "$BITRISEIO_TEST_ACCESS_TOKEN_UI_TEST_URL"

            echo "Build seperate test apk:"
            make android-ui-test

            echo "Run tests on firebase:"
            gcloud auth activate-service-account --key-file secret.json --project android-gl-native
            gcloud beta test android devices list
            gcloud beta test android run --type instrumentation --app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug.apk --test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug-androidTest.apk --device-ids shamu --os-version-ids 22 --locales en --orientations portrait --timeout 15m --test-targets "class com.mapbox.mapboxsdk.testapp.maps.widgets.AttributionTest"
    - script:
        title: Download Firebase results
        run_if: '{{enveq "SKIPCI" "false"}}'
        is_always_run: true
        inputs:
        - content: |-
            #!/bin/bash
            mkdir -p platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk

            echo "The details from Firebase will be downloaded, zipped and attached as a build artefact."
            testUri=$(gsutil ls "gs://test-lab-wrrntqk05p31w-h3y1qk44vuunw/" | tail -n1)
            echo "Downloading from : "$testUri
            gsutil -m cp -R -Z $testUri platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk

            echo "Try running ndk-stack on downloaded logcat to symbolicate the stacktraces:"
            find platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk -type f -name "logcat" -print0 | xargs -0 -Imylogcat mv -i mylogcat ./
            cat logcat | ndk-stack -sym build/android-arm-v7/Debug
    - deploy-to-bitrise-io:
        run_if: '{{enveq "SKIPCI" "false"}}'
        inputs:
        - deploy_path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk
        - is_compress: 'true'
        - notify_user_groups: none
    - slack:
        run_if: '{{enveq "SKIPCI" "false"}}'
        title: Post to Slack
        inputs:
        - webhook_url: "$SLACK_HOOK_URL"
        - channel: "#gl-bots"
        - from_username: 'Bitrise Android'
        - from_username_on_error: 'Bitrise Android'
        - message: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}>
            for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}>
            by ${GIT_CLONE_COMMIT_COMMITER_NAME}
            passed'
        - message_on_error: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}>
            for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}>
            by ${GIT_CLONE_COMMIT_COMMITER_NAME}
            failed'
        - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png
        - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png
  scheduled:
    steps:
    - script:
        title: Configure GL-native build environement
        inputs:
        - content: |-
            #!/bin/bash
            set -eu -o pipefail
            curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
            sudo apt-get install -y pkg-config nodejs cmake
    - script:
        title: Configure AWS-CLI
        inputs:
        - content: |-
            #!/bin/bash
            apt-get install -y python-pip python-dev build-essential
            pip install awscli
    - script:
        title: Download maven credentials
        inputs:
        - content: |-
            #!/bin/bash
            aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/secring.gpg

            # Add maven credentals for publishing
            echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME
            NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD
            signing.keyId=$SIGNING_KEYID
            signing.password=$SIGNING_PASSWORD
            signing.secretKeyRingFile=secring.gpg" >> platform/android/MapboxGLAndroidSDK/gradle.properties
    - script:
        title: Build release
        inputs:
        - content: |-
            #!/bin/bash
            echo "Compile libmapbox-gl.so for all supportd abi's:"
            export BUILDTYPE=Release
            make apackage
    - script:
        title: Publish to maven
        inputs:
        - content: |-
            #!/bin/bash
            echo "Upload aar file to maven:"
            cd platform/android && ./gradlew uploadArchives
    - slack:
        title: Post to Slack
        inputs:
        - webhook_url: "$SLACK_HOOK_URL"
        - channel: "#gl-bots"
        - from_username: 'Bitrise Android'
        - from_username_on_error: 'Bitrise Android'
        - message: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> Publish to maven SUCCESS.'
        - message_on_error: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> Publish to maven FAILED.'
        - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png
        - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png
  devicefarmUpload:
    steps:
    - script:
        title: Configure GL-native build environement
        inputs:
        - content: |-
            #!/bin/bash
            set -eu -o pipefail
            curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
            sudo apt-get install -y pkg-config nodejs cmake
    - script:
        title: Build release
        inputs:
        - content: |-
            #!/bin/bash
            echo "Compile libmapbox-gl.so for all supportd abi's:"
            export BUILDTYPE=Release
            make apackage
    - script:
        title: Add AWS credentials
        inputs:
        - content: |-
            #!/bin/bash
            echo "AWS_ACCESS_KEY_ID_DEVICE_FARM=$AWS_ACCESS_KEY_ID_DEVICE_FARM" >> platform/android/MapboxGLAndroidSDKTestApp/gradle.properties
            echo "AWS_SECRET_ACCESS_KEY_DEVICE_FARM=$AWS_SECRET_ACCESS_KEY_DEVICE_FARM" >> platform/android/MapboxGLAndroidSDKTestApp/gradle.properties
    - script:
        title: Generate sanity tests
        inputs:
        - content: |-
            #!/bin/bash
            echo "Generate these test locally by executing:"
            make test-code-android
    - script:
        title: Run AWS Device Farm instrumentation tests
        inputs:
        - content: |-
            #!/bin/bash
            echo "Run tests on device farm:"
            cd platform/android && ./gradlew devicefarmUpload
    - slack:
        title: Post to Slack
        inputs:
        - webhook_url: "$SLACK_HOOK_URL"
        - channel: "#gl-bots"
        - from_username: 'Bitrise Android'
        - from_username_on_error: 'Bitrise Android'
        - message: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> for devicefarmUpload passed'
        - message_on_error: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}> for devicefarmUpload failed'
        - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png
        - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png
  nightly-release:
    steps:
    - script:
        title: Configure GL-native build environement
        inputs:
        - content: |-
            #!/bin/bash
            set -eu -o pipefail
            curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
            sudo apt-get install -y pkg-config nodejs cmake
    - script:
        title: Configure AWS-CLI
        inputs:
        - content: |-
            #!/bin/bash
            apt-get install -y python-pip python-dev build-essential
            pip install awscli
    - script:
        title: Build release
        inputs:
        - content: |-
            #!/bin/bash
            echo "Compile libmapbox-gl.so for all supportd abi's:"
            export BUILDTYPE=Release
            make apackage
    - script:
        title: Log metrics
        inputs:
        - content: |-
            #!/bin/bash
            echo "Log binary size metrics to AWS CloudWatch:"
            CLOUDWATCH=true platform/android/scripts/metrics.sh