-
Notifications
You must be signed in to change notification settings - Fork 17
/
androidSamplePython_paral
96 lines (85 loc) · 3.21 KB
/
androidSamplePython_paral
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
pipeline{
agent {
label 'master'
}
stages{
stage('获取源码') {
parallel {
stage('安卓程序源码') {
steps {
sh 'mkdir -p AndroidSampleApp'
dir("AndroidSampleApp"){
git branch:'master', url:'[email protected]:princeqjzh/AndroidSampleApp.git'
}
}
}
stage('自动测试程序源码') {
steps {
sh 'mkdir -p iAppBVT_Python'
dir("iAppBVT_Python"){
git branch:'master', url:'[email protected]:princeqjzh/iAppBVT_Python.git'
}
}
}
}
}
stage('安卓编译打包') {
steps {
sh '''
. ~/.bash_profile
cd AndroidSampleApp
sh gradlew clean assembleDebug
'''
}
}
stage('测试与发布') {
parallel {
stage('发布测试包') {
steps {
archiveArtifacts artifacts: 'AndroidSampleApp/app/build/outputs/apk/debug/app-debug.apk'
}
}
stage('自动化'){
stages{
stage('部署') {
steps {
sh '''
. ~/.bash_profile
cd AndroidSampleApp
apk=app/build/outputs/apk/debug/app-debug.apk
{
#try: 卸载现有的安卓app
adb uninstall com.appsflyer.androidsampleapp
} || {
#catch
echo 'no com.appsflyer.androidsampleapp package'
}
sleep 5
#安装安卓app
adb install $apk
'''
}
}
stage('自动测试') {
steps {
sh '''
. ~/.bash_profile
cd iAppBVT_Python
#更新python依赖库
pip3.9 install -r requirements.txt
#运行自动化测试
pytest -sv test/bvt_test.py --tc-file ~/iAppBVT_Python.json --tc-format json
'''
}
}
}
}
}
}
}
post {
always {
emailext body: '$DEFAULT_CONTENT', recipientProviders: [[$class: 'RequesterRecipientProvider']], subject: '$DEFAULT_SUBJECT'
}
}
}