The continuous integration of Android has been implemented and has been applied for a period of time in the project. Coincides with a few minutes now, put some of the previous scattered bits and pieces of records and tidy up, the palace has the needs of friends reference, or subsequent reuse.
Required Preparation knowledge: Gitlab, Jenkins, various plugins, Shell and so on;
In addition, recommend a seafiles, equivalent to cloud storage network disk, you can build the APK package, sent to the team for internal use;
Of course, you can also use FTP to share with the team.
I. Overall global configuration:
Configure the relevant plugin, if you need to do code detection, you also need to install sonar, some of the following configuration:
Sonar Installations:
Name:sonar
Server url:http://192.168.0.100:9000/
Sonar Account Login:admin
Sonar Account password:*****
Database url:jdbc:mysql://localhost:3306/sonar?useunicode=true&characterencoding=utf8& Rewritebatchedstatements=true
Database Login:root
Database password:****
Email notification
SMTP Server smtp.exmail.qq.com
User default message suffix @aituyou. com
Two. Configurations in a single project:
Trigger Builder:
Build after other projects is built
Projects to Watch:tsd-common
SOURCE Management:
Git Repositories:http://121.201.13.32:9000/xiaobao/tsd-navigation.git
Build periodically: Timeline
9-21-5
Pull SCM:
9-21-5
Command Shell:
echo ' pwd ' echo"buld start time: ' Date '"Echo'******************* Start Build *************************'# #cd/var/lib/jenkins/;. /ENV.SHCD/var/lib/jenkins/jobs/tsd-nav/workspace/# # # # Dos2unix Filesdos2unix ' find.-name"*.java"` /opt/android/adt-bundle-linux-x86_64-20140624/sdk/tools/android Update project-t3+PF. -N tsd-navsed-I.'$d'project.propertiessed-I.'$d'project.propertiessed-I.'$a target=android-19'project.propertiessed-I.'$a android.library.reference.1=. /.. /tsd-common/workspace/'project.properties#sed-I.'$a android.library.reference.1=. /.. /tsd-thirdparty/workspace/qiniu-sdk/'project.properties# Change keysed-I.'s/r1em7hxagvumbu3te5mne508/0tc6r2t1utx9xgdusyquv5lo/g'/var/lib/jenkins/jobs/tsd-nav/workspace/Androidmanifest.xml/opt/ant/apache-ant-1.9.4/bin/Ant Clean/opt/ant/apache-ant-1.9.4/bin/Ant Debug/opt/ant/apache-ant-1.9.4/bin/Ant release# signer#jarsigner-verbose-keystore/home/tuyou/hao/tuyoudemokeystore-signedjar/var/LIB/JENKINS/JOBS/TSD-NAV/WORKSPACE/BIN/TSD-NAV-RELEASE-SIGNED.APK/var/lib/jenkins/jobs/tsd-nav/workspace/bin/tsd-nav-release-unsigned.apk'Tuxiaobao'-storepass'Tuxiaobao'Jarsigner-verbose-sigalg Md5withrsa-digestalg Sha1-keystore/home/tuyou/hao/tuyou_android.keystore-signedjar/var/LIB/JENKINS/JOBS/TSD-NAV/WORKSPACE/BIN/TSD-NAV-RELEASE-SIGNED.APK/var/lib/jenkins/jobs/tsd-nav/workspace/bin/tsd-nav-release-unsigned.apk Tuyou_android.keystore-storepass'Tuxiaobao'# Getversion Number#hao= ' Cat Androidmanifest.xml | grep versionname= | Awk-f"=" '{print $}'|awk-f"\"" '{print $}'' #echo ${hao} #cd/var/lib/jenkins/jobs/tsd-nav/workspace/BIN#MV TSD-nav-debug.apk tsd-nav-+${hao}.apk#ls-LA#CD/var/lib/jenkins/jobs/tsd-nav/workspace/#Getdate# Date-D now +%y%m%d%h%m%SCD/var/lib/jenkins/jobs/tsd-nav/workspace/BIN#MV TSD-nav-debug.apk tsd-nav-' CAT/var/lib/jenkins/jobs/tsd-nav/workspace/androidmanifest.xml | grep versionname= | Awk-f"=" '{print $}'|awk-f"\"" '{print $}''. APKMV TSD-nav-release-signed.apk tsd-nav-release-' CAT/var/lib/jenkins/jobs/tsd-nav/workspace/androidmanifest.xml | grep versionname= | Awk-f"=" '{print $}'|awk-f"\"" '{print $}''-' date-d now +%y%m%d%h%m%S '. APKCD/var/lib/jenkins/jobs/tsd-nav/workspace/#FTP Directory:/var/ftp/anonymous/UPLOADCP/var/LIB/JENKINS/JOBS/TSD-NAV/WORKSPACE/BIN/TSD-NAV-RE*.APK/var/ftp/anonymous/upload/tsd-app-release/nav/#copy to SEAFILESCP/var/lib/jenkins/jobs/tsd-nav/workspace/bin/tsd-nav-re*.apk/home/tuyou/seafile/seafile/Release/Autobuildecho'******************* Finish Build *************************'Echo"buld End time: ' Date '"
In fact, there is not too much explanation, if you need to know the details of friends, you can contact me.
CI Practice _android Continuous integration