-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
113 lines (96 loc) · 2.68 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
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
image: jangrewe/gitlab-ci-android
variables:
ANDROID_COMPILE_SDK: "28"
APP_NAME: "MeisterKoch"
cache:
key: ${CI_PROJECT_ID}
paths:
- .m2/
- .gradle/
stages:
- build
#- test
- package
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- apt-get update -y && apt-get install wget -y
########################################################################
# BUILD
.build_template: &build
stage: build
artifacts:
expire_in: 4 hours
paths:
- app/build/outputs/
build:development:
<<: *build
only:
- development
script:
- ./gradlew assembleDebug
build:release:
<<: *build
only:
- master
script:
- ./gradlew assembleRelease
########################################################################
# TESTS
#.test_template: &test
# stage: test
# only:
# - master
# - development
#
#test:unit:
# <<: *test
# script:
# - ./gradlew test
#
#test:functional:
# <<: *test
# script:
# - wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
# - chmod +x android-wait-for-emulator
# - echo y | ${ANDROID_HOME}/tools/bin/sdkmanager "system-images;android-${ANDROID_COMPILE_SDK};google_apis_playstore;x86"
# - echo y | ${ANDROID_HOME}/tools/bin/sdkmanager --update
# - echo no | ${ANDROID_HOME}/tools/bin/avdmanager create avd -k "system-images;android-${ANDROID_COMPILE_SDK};google_apis_playstore;x86" -n test
# - ${ANDROID_HOME}/tools/emulator -avd test -no-window -no-audio
# - ./android-wait-for-emulator
# - adb shell input keyevent 82
# - ./gradlew cAT
########################################################################
# PACKAGE
.package_template: &package
before_script:
- export VERSION_NAME=`egrep '^[[:blank:]]+versionName[[:blank:]]' app/build.gradle | awk '{print $2}' | sed s/\"//g`
- mkdir -p exported
package:development:
<<: *package
stage: package
environment: Development
only:
- development
script:
- mv app/build/outputs/apk/debug/app-debug.apk ./exported/${APP_NAME}-v$VERSION_NAME-debug.apk
dependencies:
- build:development
artifacts:
expire_in: 7 days
paths:
- exported
package:release:unsigned:
<<: *package
stage: package
environment: Release
only:
- master
script:
- mv app/build/outputs/apk/release/app-release-unsigned.apk ./exported/${APP_NAME}-v$VERSION_NAME-release-unsigned.apk
dependencies:
- build:release
artifacts:
expire_in: 1 month
paths:
- exported