Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Construction of Android and iOS apps use Jenkins Automation     - When a software RAID data recovery and reconstruction of how failure (Linux)

- Redhat Close SELinux correct step (Linux)

- How to use the Linux command compress JPEG images (Linux)

- ORA-00824: can not set sga_target due to existing problem-solving (Database)

- Django1.5 Custom User Model (Programming)

- Linux System Getting Started Learning: Linux how to install 7zip (Linux)

- MongoDB Learning the notes (Database)

- Everyone should know something about TCP (Linux)

- To install Cinnamon desktop environment on your Ubuntu 14.04 / 12.04 (Linux)

- NFS-based services and service utilization Corosync DRBD high availability cluster configuration, respectively (Server)

- Boost notes --Thread - problems encountered in the initial use on Ubuntu (Programming)

- Delete specific files using bash directory under Linux (Linux)

- To solve the Mac in question invalid BASH under configuration environment variable (Linux)

- Linux system ARP attack solution (Linux)

- OpenJDK7 source compiler installation on CentOS 6.5 (Linux)

- Automatic and Manual Proxy Settings Switch GNOME Shell Extension Proxy Switcher Recommend (Linux)

- 2016, the new Node project Precautions (Programming)

- Linux environment installation of rvm and ruby (Linux)

- Ubuntu installation 2.10.x version of Scala (Linux)

- Through the source code to install MySQL 5.6.26 under CentOS6 (Database)

  Construction of Android and iOS apps use Jenkins Automation
  Add Date : 2018-11-21      

With the evolution of business needs, the complexity of the project will gradually increase, the increasingly strong automation practice. In fact, automation engineering has been the goal of our efforts, we can improve productivity, maximize reduce the probability of human error, to achieve a number of complex business requirements strain.
Scene follows, testers now need to test each new version, developers are required to package and put ftp, testers and ftp to copy from the local (or using the phone's ES File Manager), and then install. Especially near the hair version of the week, the new version almost every day. In this case, there are two effects: first, interrupted the progress of the development developers; second, developers packaged low efficiency, especially ios, the words ring true, always hit the wrong (may be an issue the certificate) .
To solve this problem, you must move the client application to automate the construction. Specifically, it is to use continuous integration (CI) system jenkins, automatically detect and pull the latest code, and automatic packaging of Android apk ios the ipa, automatically uploaded to the measured distribution platform dandelions. (Next, testers simply open one (or more) fixed site, scan the two-dimensional code, you can download the latest version ...)


To compile because ios, so I chose Mac OSX 10.11.1.
Regardless of which operating system, jenkins configuration is the same.

Installation Jenkins

Official website address: http: //jenkins-ci.org/

// Use the brew installation
brew install jenkins
// Start direct service to start running jenkins

Default access http: // localhost: 8080 /, enter jenkins configuration page.

Jenkins related plug-ins installed

Click System Administration> Manage Plugins> Optional plug-ins, you can search for the following plug-in installation

git plugin (GIT plugin)
ssh plugin (SSH Credentials Plugin)
Gradle plugin (Gradle plugin) - android dedicated
Xcode plug (Xcode integration) - ios dedicated

New Job

Home Page, New -> Build a free-style software project can be.
For similar projects, you can select -> copy an existing Item, the name of the task you want to copy, enter the first character will have a job other smart tips.

Configure git repository

If you have installed git plugin appears in the Git source code management will, after selected:
Repositories -> https://github.com/openproject/ganchai, even if it is ssh configuration Credentials.
Branch -> * / master, select a branch to compile the code.

If a private warehouse (eg git: //xxxxx.git), click Credentials - Add, the dialog box, the most simple configuration sshkey

Configuring automatic pull the latest code

In constructing the trigger, there are two automatic pull code and compile strategies:

1. Set the Poll SCM, set the timer, regularly check code updates, updates the compiler, or do not compile (I do with this).

2. You can also set the Build periodically, periodically compile task.

About timer format, I can only excerpt from the Internet a little tricky for some little explanation:

. This field follows the syntax of cron (with minor differences) Specifically, each line consists of 5 fields separated by TAB or whitespace:


MINUTE Minutes within the hour (0-59)
HOUR The hour of the day (0-23)
DOM The day of the month (1-31)
MONTH The month (1-12)
DOW The day of the week (0-7) where 0 and 7 are Sunday.

To specify multiple values ​​for one field, the following operators are available. In the order of precedence,

   * '*' Can be used to specify all valid values.
   * 'M-N' can be used to specify a range, such as "1-5"
   * 'MN / X' or '* / X' can be used to specify skips of X ''s value through the range, such as "* / 15" in the MINUTE field for "0,15,30,45" and "1-6 / 2" for "1,3,5"
   * 'A, B, ..., Z' can be used to specify multiple values, such as "0,30" or "1,3,5"

Empty lines and lines that start with '#' will be ignored as comments.
In addition, @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly are supported.
Here are two examples:

// Every minute
* * * * *
// Every 5 mins past the hour
5 * * * *

Configuration gradle - android dedicated

Please ios friends drifting.
If you install the plug-gradle successful, it should appear under the figure Invoke Gradle script, configure the look

$ {WORKSPACE} represents the current workspace directory under the job is mainly to store code. More environment variables refer to the appendix at the end of the text.
In this way, it can automatically generate apk app in the project under the build / outputs / apk.
Compilation failed? You may want to address the following two questions:

1.gradle no configuration environment variable.
For example, I configured in / etc / profile clicking GRADLE_HOME:

export GRADLE_HOME = '/ home / jay / .gradle / wrapper / dists / gradle-2.2.1-all / c64ydeuardnfqctvr1gm30w53 / gradle-2.2.1'
export PATH = $ GRADLE_HOME / bin: $ PATH
2. find local.properties in sdk definition.
Because in general local.properties not added to the repository.
So we need to manually copy the next Project directory under $ {WORKSPACE} (refer to himself Android Studio project structure).
Definition local.properties, where records look, make a copy:

sdk.dir = xx / xx / android-sdk
Then compile the general will compile successfully, of course, when those third-party libraries need to re-download, the compiler may be slow.

Configuration xcode - ios dedicated

Please android students drifting away.
After installing Xcode plug-in, you can see the following chart interface and configuration

There are two caveats.

1. Signed
2. Need Shared Schema file.
Dandelion uploaded to the platform

In the official website of the document, there are instructions by uploading app linux platform critical code

curl -F "file=@/tmp/example.ipa" -F "uKey =" -F "_api_key =" http://www.pgyer.com/apiv1/app/upload


# $ {Version} put it as v1.0
curl -F "file=@/home/xxx/release/ganchai-release-${version}-0101-dev.apk" -F "uKey = 231xxxxe6" -F "_api_key = 0xxxx499" -F "publishRange = 2" http://www.pgyer.com/apiv1/app/upload

This completes a dandelion uploaded to the app.

In fact, we may be faced with more complex scenarios, such as the above $ {version}, while the version in build.gradle defined as follows:

ext {
    compileSdkVersion = 22
    buildToolsVersion = "23.0.1"
    minSdkVersion = 10
    targetSdkVersion = 22
    versionCode = 1111
    versionName = "v1.2.0.0"

Need to find ways to read versionName, and then spell out the final name of the file, so after the next upgrade version can dynamically upload the app to the dandelion.

# Use the sed command to read, using cut cut, eventually dynamic read versionName
version = `sed -n '21, 1p '$ {WORKSPACE} /xxx/build.gradle | cut -c20-27`

This is the android apk upload process, appropriate, ios is uploaded ipa, the method is the same, not repeat them.


After the developers released version of the work automation, this way, at any time convenient for testers and pull to build the latest version, but the liberation of the developer's own version of the work made, a word, good!


Jenkins those environment variables defined:

The following variables are available to shell scripts

The current build number, such as "153"
The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
The display name of the current build, which is something like "# 153" by default.
Name of the project of this build, such as "foo" or "foo / bar". (To strip off folder paths from a Bourne shell script, try: $ {JOB_NAME ## * /})
String of "jenkins - $ {JOB_NAME} - $ {BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification.
The unique number that identifies the current executor (among executors of the same machine) that's carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.
Name of the slave if the build is on a slave, or "master" if run on master
Whitespace-separated list of labels that the node is assigned.
The absolute path of the directory assigned to the build as a workspace.
The absolute path of the directory assigned on the master node for Jenkins to store data.
Full URL of Jenkins, like http: // server: port / jenkins / (note: only available if Jenkins URL set in system configuration)
Full URL of this build, like http: // server: port / jenkins / job / foo / 15 / (Jenkins URL must be set)
Full URL of this job, like http: // server: port / jenkins / job / foo / (Jenkins URL must be set)
Subversion revision number that's currently checked out to the workspace, such as "12345"
Subversion URL that's currently checked out to the workspace.
- How to remove the files inside the privacy of data on Linux (Linux)
- Installation JDK1.7 under Ubuntu14.04 64-bit (Linux)
- CentOS7 install MySQL 5.5 (Database)
- The most concise Systemd tutorial, just ten minutes (Linux)
- Android WebView use layman (Programming)
- Forwarding module with Apache reverse proxy server (Server)
- CentOS 6.6 shortcut command execution (Linux)
- Spring use Cache (Programming)
- Linux system performance monitoring with Nmon (Linux)
- Hadoop 2.2.0 installation development environment (standalone pseudo-distributed mode) (Server)
- CentOS6 installed Tomcat (Server)
- Linux `dirname $ 0` (Linux)
- DDOS Attacks and Prevention (Linux)
- Android determine the device network connection status, and determine the connection (Programming)
- CMake Quick Start Tutorial (Linux)
- MySQL database under Linux to achieve automatic backup scheduled backup day (Database)
- Linux NIC configuration (Linux)
- linux server security (Linux)
- Wi-Fi hackers use to attack your seven methods (Linux)
- PostgreSQL use pgpool achieve high availability (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.