Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Construction of Android and iOS apps use Jenkins Automation     - PHP with FastCGI and mod_php Comments (Server)

- Definition Format Oracle basis of various statements (Database)

- Configuring xdebug debugging environment in Ubuntu 14.04 under the PhpStorm (Linux)

- Using IntelliJ IDEA 13 integrated development environment to build Android (Linux)

- Android custom controls create the simplest skid menu in the history (Programming)

- What is the Docker (Linux)

- Python2 ---- function using dictionaries (Programming)

- Oracle how to assess the true concurrent session (Database)

- Recovery from MySQL master data consistency summary (Database)

- HomeKit Human Interface Guidelines (Linux)

- Linux Network Programming - signal blocking and shielding (block, unblock) (Programming)

- Oracle table space is too large processing time (Database)

- CentOS 7 Change Hostname (Linux)

- Remote installation of Net-SNMP whole process (Linux)

- CentOS ClamAV antivirus package updates (Linux)

- Mounting kit under Fedora Linux (Linux)

- GAMIT learning materials finishing (Linux)

- The REVERSE function of DB2 (Database)

- Enable Intel Rapid Start in GNU / Linux (Linux)

- Install Ubuntu text editor KKEdit 0.2.10 (Linux)

  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.
- Sublime Text Add instructions to insert the current time zone (Linux)
- MongoDB uses aggregate, group, match mysql achieve in having (count (1)> 1) features (Database)
- Common Linux System Troubleshooting (Linux)
- CentOS7 management of systemd (Linux)
- New features of Java 9 HTTP2 and REPL (Programming)
- How to use Linux iptables tool for network sharing (Linux)
- Vim highlight lookup operation (Linux)
- Python dictionary applications get built-in method (Programming)
- Puppet 3.5 Source package Installation and Configuration (Server)
- VMware difference in three network connection (Linux)
- Modify MySQL character encoding under Linux (Database)
- How to manage the time and date at systemd Linux systems (Linux)
- Install Redis 2.6 5.5 32 position CentOS error resolved (Linux)
- Create a custom pixel format based on an existing image data BufferedImage (Programming)
- Web cache basics: terminology, HTTP headers, and caching policies (Server)
- Object-oriented language Java some of the basic features (Programming)
- Virt Related Command Summary (Linux)
- Linux 6 install Oracle 11g (64bit) (Database)
- How to allow users to access only a specific database (MSSQL) (Database)
- Python variable type (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.