summaryrefslogtreecommitdiff
path: root/circle.yml
blob: 6cafa072c335346d15f02154a4e4d3fb2e2fd79f (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
version: 2

jobs:

# ------------------------------------------------------------------------------
  build:
    docker:
      - image: mbgl/ci:trigger_job
    working_directory: /
    steps:
      - deploy:
          name: Trigger 'android-debug-arm-v7'
          command: trigger_job android-debug-arm-v7
      - deploy:
          name: Trigger 'android-release-all'
          command: trigger_job android-release-all

# ------------------------------------------------------------------------------
  android-debug-arm-v7:
    docker:
      - image: mbgl/ci:r2-android-ndk-r13b-gradle
    working_directory: /src
    environment:
      LIBSYSCONFCPUS: 6
      JOBS: 6
      BUILDTYPE: Debug
    steps:
      - checkout
      - run:
          name: Build libmapbox-gl.so for arm-v7
          command: make android-lib-arm-v7
      - run:
          name: Compile Core tests for arm-v7
          command: make android-test-lib-arm-v7
      - run:
          name: Test phone module
          command: make run-android-unit-test
      - run:
          name: Test wear module
          command: make run-android-wear-unit-test
      - run:
          name: Generate Espresso sanity tests
          command: make test-code-android
      - run:
          name: Check Java code style
          command: make android-checkstyle
      - run:
          name: Build Test APK
          command: |
            echo "${MAPBOX_DEVELOPER_CONFIG_XML}" > platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml
            make android-ui-test-arm-v7
      - 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 android-gl-native
            rm secret.json
      - run:
          name: Run instrumentation tests on Firebase
          shell: /bin/bash -euo pipefail
          command: |
            gcloud firebase test android models list
            (gcloud firebase 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" 2>&1 | tee firebase.log) || EXIT_CODE=$?

            FIREBASE_TEST_BUCKET=$(sed -n 's|^.*\[https://console.developers.google.com/storage/browser/\([^]]*\).*|gs://\1|p' firebase.log)
            echo "Downloading from: ${FIREBASE_TEST_BUCKET}"
            gsutil -m cp -n -R -Z "$FIREBASE_TEST_BUCKET*" 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 -I '{}' ${ANDROID_NDK_HOME}/ndk-stack -sym build/android-arm-v7/Debug -dump {}

            exit ${EXIT_CODE:-0}
      - store_artifacts:
          path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk
          destination: .

# ------------------------------------------------------------------------------
  android-release-all:
    docker:
      - image: mbgl/ci:r2-android-ndk-r13b-gradle
    working_directory: /src
    environment:
      LIBSYSCONFCPUS: 6
      JOBS: 6
      BUILDTYPE: Release
    steps:
      - checkout
      - run:
          name: Generate Maven credentials
          shell: /bin/bash -euo pipefail
          command: |
            aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/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" >> platform/android/MapboxGLAndroidSDK/gradle.properties
      - run:
          name: Build libmapbox-gl.so for arm-v7
          command: make android-lib-arm-v7
      - run:
          name: Build libmapbox-gl.so for arm-v8
          command: make android-lib-arm-v8
      - run:
          name: Build libmapbox-gl.so for arm-v5
          command: make android-lib-arm-v5
      - run:
          name: Build libmapbox-gl.so for mips
          command: make android-lib-mips
      - run:
          name: Build libmapbox-gl.so for x86
          command: make android-lib-x86
      - run:
          name: Build libmapbox-gl.so for x86-64
          command: make android-lib-x86-64
      - run:
          name: Build package
          command: make apackage
      - store_artifacts:
          path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk
          destination: .
      - deploy:
          name: Show statistics
          command: |
            [ "${CIRCLE_BRANCH}" == "master" ] && export CLOUDWATCH=true
            platform/android/scripts/metrics.sh
      - deploy:
          name: Publish to Maven
          command: |
            if [ "${CIRCLE_BRANCH}" == release-* ]; then make run-android-upload-archives ; fi