Repository navigation
Expand file tree
/
Copy pathAndroid-Config.xml
More file actions
59 lines (50 loc) · 2.83 KB
/
Copy pathAndroid-Config.xml
File metadata and controls
59 lines (50 loc) · 2.83 KB
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
<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="workflow-job@2.3">
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.6">
<script>
node{
stage 'Checkout'
git credentialsId: 'ADD YOUR CRED ID', url: 'git@git.tom.redhatmobile.com:jnakfour/Innovation-Lab-Android-Native-Blank-Native-Android-Gradle-App.git'
stage 'Run Emulator'
// Android emulator plugin does not support pipeline yet
//step([$class: 'AndroidEmulator', testResults: 'app/build/test-results/debug/*.xml'])
withEnv(["PATH+emulator=/opt/android-sdk-linux/tools/"]) {
sh '/opt/android-sdk-linux/platform-tools/adb start-server'
//sh 'emulator -engine classic -ports 5730,5731 -report-console tcp:5854,max=60 -avd android-23-emulator -no-snapshot-load -no-snapshot-save -no-window'
sh 'emulator -engine classic -ports 5730,5731 -avd android-23-emulator -noaudio -no-snapshot-load -no-snapshot-save -no-window &'
//sh 'emulator -port 5730 -avd android-23-emulator -no-boot-anim -noaudio -no-window &'
sh '/var/lib/jenkins/scripts/check-emulator-status'
// Unlock emulator screen
// Attempting to unlock emulator screen
sh '/opt/android-sdk-linux/platform-tools/adb -s emulator-5730 shell input keyevent 82'
sh '/opt/android-sdk-linux/platform-tools/adb -s emulator-5730 shell input keyevent 4'
}
stage 'Build'
withEnv(["ANDROID_HOME=/opt/android-sdk-linux"]) {
sh './gradlew clean assemble connectedAndroidTest test'
}
stage 'Archive apk'
archive '**/*.apk'
/* stage 'Install apk on Emulator'
withEnv(["PATH+emulator=/opt/android-sdk-linux/tools/"]) {
// uninstall apk first
sh '/opt/android-sdk-linux/platform-tools/adb -s emulator-5730 uninstall org.feedhenry.blank'
sh '/opt/android-sdk-linux/platform-tools/adb -s emulator-5730 install -r app/build/outputs/apk/app-debug.apk'
}*/
stage 'Archive JUnit tests'
step([$class: 'JUnitResultArchiver', testResults: 'app/build/test-results/debug/*.xml'])
stage 'Archive Instrumented JUnit tests'
step([$class: 'JUnitResultArchiver', testResults: 'app/build/outputs/androidTest-results/connected/*.xml'])
stage "Stop Android Emulator and adb"
sh '/opt/android-sdk-linux/platform-tools/adb -s emulator-5730 emu kill'
//sh '/opt/android-sdk-linux/platform-tools/adb kill-server'
}
</script>
<sandbox>true</sandbox>
</definition>
<triggers/>
</flow-definition>