forked from emschu/snmp-cockpit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
194 lines (181 loc) · 6.55 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
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
image: kmindi/android-ci:platforms-25-26-27
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
# Define cache-folders withing the build-folder to make it available for GitLab CI caching
# http://stackoverflow.com/a/36050711/2170109
# https://developer.android.com/studio/build/build-cache.html
- grep -ciE 'processor' /proc/cpuinfo
- export ANDROID_SDK_HOME=$CI_PROJECT_DIR
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- echo 'y' | sdkmanager 'build-tools;28.0.3' 1> /dev/null
stages:
- build
- test
- instrumentationtest
- report
cache:
key: "${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}"
paths:
- .gradle/
- .android/build-cache/
build:tagged:
stage: build
tags:
- docker
script:
- ./gradlew assembleDebug
artifacts:
name: "SnmpCockpit_${CI_COMMIT_TAG}"
paths:
- app/build/outputs/apk/
only:
- tags
build:
stage: build
tags:
- docker
script:
- ./gradlew assembleDebug
artifacts:
name: "SnmpCockpit_${CI_JOB_ID}"
expire_in: 1 week
paths:
- app/build/outputs/apk/
except:
- tags
test:unit:
stage: test
tags:
- docker
script:
- ./gradlew test jacocoTestReport
- cat "app/build/reports/jacoco/jacocoTestReport/html/index.html"
coverage: '/Total.+?([0-9]{1,3})\%/'
artifacts:
name: "tests-unit-${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
expire_in: 6 h
paths:
- "app/build/intermediates/classes/debug"
- "app/build/reports/*"
- "app/build/jacoco/*.exec"
test:instrumentation:25:
stage: instrumentationtest
tags:
- docker
- kvm
script:
- echo no | avdmanager -v create avd --force --name emulator-25 --abi google_apis/x86 --package "system-images;android-25;google_apis;x86"
- export SHELL=/bin/bash && echo "no" | emulator -avd emulator-25 -noaudio -no-window -gpu off -skin 1080x1920 -verbose -qemu -enable-kvm &
- adb wait-for-device
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0.0 &
- adb shell settings put global transition_animation_scale 0.0 &
- adb shell settings put global animator_duration_scale 0.0 &
- export TERM=${TERM:-dumb}
- export ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
- assure_emulator_awake.sh "./gradlew createDebugCoverageReport" #createDebugCoverageReport calls connectedAndroidTests
- cat "app/build/reports/coverage/debug/index.html"
coverage: '/Total.+?([0-9]{1,3})\%/'
allow_failure: true
when: manual
artifacts:
name: "tests-instrumentation-25-${CI_JOB_NAME}"
expire_in: 6 h
paths:
- "app/build/reports/*"
- "app/build/outputs/code-coverage/connected/*.ec"
test:instrumentation:26_64:
stage: instrumentationtest
tags:
- docker
- kvm
script:
- echo no | avdmanager -v create avd --force --name emulator-26_64 --abi google_apis/x86_64 --package "system-images;android-26;google_apis;x86_64"
- export SHELL=/bin/bash && echo "no" | emulator -avd emulator-26_64 -noaudio -no-window -gpu off -skin 1080x1920 -verbose -qemu -enable-kvm &
- adb wait-for-device
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0.0 &
- adb shell settings put global transition_animation_scale 0.0 &
- adb shell settings put global animator_duration_scale 0.0 &
- export TERM=${TERM:-dumb}
- export ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
- assure_emulator_awake.sh "./gradlew createDebugCoverageReport" #createDebugCoverageReport calls connectedAndroidTests
- cat "app/build/reports/coverage/debug/index.html"
coverage: '/Total.+?([0-9]{1,3})\%/'
allow_failure: true
when: manual
artifacts:
name: "tests-instrumentation-26_64-${CI_JOB_NAME}"
expire_in: 6 h
paths:
- "app/build/reports/*"
- "app/build/outputs/code-coverage/connected/*.ec"
test:instrumentation:26:
stage: instrumentationtest
tags:
- docker
- kvm
script:
- echo no | avdmanager -v create avd --force --name emulator-26 --abi google_apis/x86 --package "system-images;android-26;google_apis;x86"
- export SHELL=/bin/bash && echo "no" | emulator -avd emulator-26 -noaudio -no-window -gpu off -skin 1080x1920 -verbose -qemu -enable-kvm &
- adb wait-for-device
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0.0 &
- adb shell settings put global transition_animation_scale 0.0 &
- adb shell settings put global animator_duration_scale 0.0 &
- export TERM=${TERM:-dumb}
- export ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
- assure_emulator_awake.sh "./gradlew createDebugCoverageReport" #createDebugCoverageReport calls connectedAndroidTests
- cat "app/build/reports/coverage/debug/index.html"
coverage: '/Total.+?([0-9]{1,3})\%/'
allow_failure: true
when: manual
artifacts:
name: "tests-instrumentation-26-${CI_JOB_NAME}"
expire_in: 6 h
paths:
- "app/build/reports/*"
- "app/build/outputs/code-coverage/connected/*.ec"
#test:instrumentation:27:
# stage: instrumentationtest
# tags:
# - docker
# - kvm
# script:
# - echo no | avdmanager -v create avd --force --name emulator-27 --abi google_apis/x86 --package "system-images;android-27;google_apis;x86"
# - export SHELL=/bin/bash && echo "no" | emulator -avd emulator-27 -noaudio -no-window -gpu off -skin 1080x1920 -verbose -qemu -enable-kvm &
# - adb wait-for-device
# - android-wait-for-emulator
# - adb shell settings put global window_animation_scale 0.0 &
# - adb shell settings put global transition_animation_scale 0.0 &
# - adb shell settings put global animator_duration_scale 0.0 &
# - export TERM=${TERM:-dumb}
# - export ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
# - assure_emulator_awake.sh "./gradlew createDebugCoverageReport" #createDebugCoverageReport calls connectedAndroidTests
# - cat "app/build/reports/coverage/debug/index.html"
# coverage: '/Total.+?([0-9]{1,3})\%/'
# allow_failure: true
# when: manual
# artifacts:
# name: "tests-instrumentation-27-${CI_JOB_NAME}"
# expire_in: 6 h
# paths:
# - "app/build/reports/*"
# - "app/build/outputs/code-coverage/connected/*.ec"
reportAllCoverage:
stage: report
tags:
- docker
script:
- ./gradlew jacocoTestReport
- rm -dR "app/build/reports/coverage" || true
- cat "app/build/reports/jacoco/jacocoTestReport/html/index.html"
coverage: '/Total.+?([0-9]{1,3})\%/'
artifacts:
name: "build-reports-${CI_JOB_NAME}"
expire_in: 1 week
paths:
- "app/build/reports/*"
when: manual