-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
43 lines (36 loc) · 2.45 KB
/
.gitlab-ci.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
before_script:
# download keys
- python tools/download.py --token ${AUTO_CLOSE_TOKEN} --key-version agxzfmF1dG8tY2xvc2VyGAsSC1Byb2plY3RLZXlzGICAgKDI0JMKDA
# setup version name and code
- export VERSION_NAME="$(git describe --match 'v*.*.*' --always)-$(git rev-list HEAD --count)$(git status | grep 'clean' --quiet || echo '-draft')"
- export VERSION_CODE="$(git rev-list HEAD --count)"
- echo "Building version $VERSION_NAME ($VERSION_CODE)"
# setup version name and code for build.gradle script
- printf "org.gradle.jvmargs=-XX:MaxPermSize=8g\nversionName=${VERSION_NAME}\nversionCode=${VERSION_CODE}\ndisablePreDex=true\nautoCloseToken=${AUTO_CLOSE_TOKEN}\n" > gradle.properties
# setup android sdk and licenses
- mkdir -p "${ANDROID_HOME}/licenses"
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "${ANDROID_HOME}/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license"
- echo -e "\nd975f751698a77b662f1254ddbeed3901e976f5a" > "${ANDROID_HOME}/licenses/intel-android-extra-license"
# client build will start when adding tag v*.*.*
- export FOR_CLIENT="$([[ "${CI_BUILD_TAG}" =~ ^v([0-9]+\.)*[0-9]+$ ]] && echo "TRUE")"
# testers will receive builds from master, for client or any tag
- export FOR_TESTERS="$([[ "${CI_BUILD_REF_NAME}" == "master" || "${CI_BUILD_REF_NAME}" == "develop" || "${FOR_CLIENT}" || "${CI_BUILD_TAG}" ]] && echo "TRUE")"
build:
# docker image for build
image: jacekmarchwicki/android:ubuntu-16-04-java7-8
script:
# build application and run additional upload to play store and upload to fabric
- ./gradlew --parallel --stacktrace build assembleDevDebugAndroidTest signingReport $(test "${FOR_TESTERS}" && echo "uploadArchives") $(test "${FOR_TESTERS}" && echo "crashlyticsUploadDistributionProdRelease crashlyticsUploadDistributionProdStaging crashlyticsUploadDistributionProdLocal") $(test "${FOR_CLIENT}" && echo "publishRelease")
# Upload to auto-close
- if [[ "${FOR_TESTERS}" ]]; then python tools/upload.py --token ${AUTO_CLOSE_TOKEN} --build-name "${VERSION_NAME}" --auto-close $(test "${FOR_CLIENT}" && echo "--final") app/build/outputs/ app/build/reports/; fi
cache:
key: "$CI_BUILD_NAME"
paths:
- .gradle/
- .android/
variables:
GRADLE_USER_HOME: ${CI_PROJECT_DIR}/.gradle
ANDROID_HOME: ${CI_PROJECT_DIR}/.android
tags:
- docker