Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Construction of Android and iOS apps use Jenkins Automation     - Linux Basic Course: tar command description (Linux)

- installation process of Matlab 2012a under Ubuntu 14.04 (Linux)

- Comparison of sorting algorithms (Programming)

- Static member variable modified (Programming)

- 5 steps to help you become a good Docker contributors (Linux)

- Python pickle module for simple use notes (Programming)

- Give your photos Instagram style filters plus program in ubuntu (Linux)

- CentOS6.5 install SVN & visual management tools iF.SVNAdmin (Server)

- How to use Aptik to backup and restore Apps/PPAs under ubuntu (Linux)

- JavaScript in this usage (Programming)

- Linux Tutorial ---- fundamentals of data traffic redirection (Linux)

- Zabbix API and PHP configuration (Server)

- Using PPA to install the lightweight theme software HotShots 2.1.0 under Ubuntu (Linux)

- CentOS 6.4 compiler installed MySQL 5.6.14 (Database)

- CMake Quick Start Tutorial (Linux)

- Use Elasticsearch + Logstash + Kibana set up centralized log Practice Analysis Platform (Server)

- To install Jetty server configuration in detail (Server)

- Django template inheritance child (Programming)

- Awk include binding capacity larger than the specified size of all files directory (Linux)

- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (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.
- Ubuntu: To install chat client Chatty 0.6.1 (Linux)
- Linux password file security issues detailed usage (Linux)
- Rman Oracle database backup and recovery plan (Database)
- Linux tar compressed exclude a folder (Linux)
- Linux CentOS configuration SVN + SVN hook (Server)
- CentOS 7 Add yum source (Linux)
- 10 important Linux ps command combat (Linux)
- Ubuntu 14.04 LTS NTFS partition can not access solution (Linux)
- Linux-du and df command (Linux)
- After reloading the cinder-volume OpenStack not start properly (Server)
- How to use the character in C ++ without pressing the Enter key to enter the Show (Programming)
- Use Linux firewall camouflage defense hacked (Linux)
- RocketMQ Message Queuing simple deployment (Linux)
- SUSE Firewall Configuration (Linux)
- Linux script commands - terminal recorder (Linux)
- Linux System Getting Started Learning: Debian download, installation and graphical interface (Linux)
- Present Situation and Development Trend of firewall products (Linux)
- Linux operating system log system (Linux)
- The YUM package management under Linux (Linux)
- CentOS 5.x install Lua 5.2.3 error (LIBS = -lncurses) (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.