forked from mapbox/mapbox-android-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
125 lines (124 loc) · 4.67 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
version: 2
workflows:
version: 2
default:
jobs:
- primary:
filters:
tags:
only: /.*/
branches:
only: /.*/
- release:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
# ------------------------------------------------------------------------------
jobs:
primary:
docker:
- image: mbgl/61abee1674:android-ndk-r18
working_directory: ~/code
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "MapboxAndroidDemo/build.gradle" }}
- run:
name: Clean gradle
command: ./gradlew clean
- run:
name: Add preferences to gradle.properties file
command: |
echo "android.useAndroidX=true" >> gradle.properties
echo "android.enableJetifier=true" >> gradle.properties
echo "org.gradle.jvmargs=-Xmx4608m" >> gradle.properties
echo "android.enableR8=false" >> gradle.properties
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "MapboxAndroidDemo/build.gradle" }}
- run:
name: Create google-services.json file
shell: /bin/bash -euo pipefail
command: |
if [ -n "${GOOGLE_SERVICES_JSON_RELEASE}" ]; then
echo "${GOOGLE_SERVICES_JSON_RELEASE}" > MapboxAndroidDemo/google-services.json
fi
- run:
name: Add Fabric keys to fabric.properties file
command: |
if [ -n "${FABRIC_API_SECRET}" && -n "${FABRIC_API_KEY}" ]; then
echo "${FABRIC_API_SECRET}" >> MapboxAndroidDemo/fabric.properties
echo "${FABRIC_API_KEY}" >> MapboxAndroidDemo/fabric.properties
fi
- 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-android-demo
rm secret.json
- run:
name: Check code style
command: make checkstyle
- run:
name: Generate Espresso sanity tests
command: make sanity-test-example-activities
- run:
name: Run Firebase instrumentation tests
command: |
#!/bin/bash
./gradlew :MapboxAndroidDemo:assembleglobalDebug --continue
./gradlew :MapboxAndroidDemo:assembleAndroidTest --continue
gcloud firebase test android run \
--type instrumentation \
--app MapboxAndroidDemo/build/outputs/apk/global/debug/MapboxAndroidDemo-global-debug.apk \
--test MapboxAndroidDemo/build/outputs/apk/androidTest/global/debug/MapboxAndroidDemo-global-debug-androidTest.apk \
--device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 5m
- store_artifacts:
path: MapboxAndroidDemo/build/outputs/apk/global/debug/MapboxAndroidDemo-global-debug.apk
# ------------------------------------------------------------------------------
release:
docker:
- image: mbgl/61abee1674:android-ndk-r18
working_directory: ~/code
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "MapboxAndroidDemo/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "MapboxAndroidDemo/build.gradle" }}
- run:
name: Export developer-config.xml & Google Play authentication json
command: |
#!/bin/bash
echo "${PLAY_PUBLISH_AUTH_JSON}" > android-gl-native-6d21dd280e7b.json
- run:
name: Create google-services.json file
shell: /bin/bash -euo pipefail
command: |
if [ -n "${GOOGLE_SERVICES_JSON_RELEASE}" ]; then
echo "${GOOGLE_SERVICES_JSON_RELEASE}" > MapboxAndroidDemo/google-services.json
fi
- run:
name: Release to Google Play
command: ./gradlew publishGlobalRelease
# ------------------------------------------------------------------------------