1 Installing Jenkins
Jenkins is a continuous integration tool based on Java development. So, to use Jenkins, you must first install the JDK.
JDK Installation
Jdk
JDK 1.8.png
Install the JDK process slightly, don't say you will not install (if there is not installed, self-Baidu).
Jenkins installation
Jenkins
Jenkins installation file. png
Click on Mac OS X in the image to automatically download "Jenkins-1.644.pkg"
The installation process is slightly (after double-clicking the jenkins-1.644.pkg, the next step is OK).
Note: 1, after the successful installation of Jenkins, will create a Jenkins user, and Jenkins's working range by default in the "/user/Shared/jenkins/home/jobs" directory, you can use finder--> to enter.
2. The read and write permission of the folder under the Jenkins directory is only open to Jenkins users, so the following Apple certificate must be installed under the Jenkins user, and the IPA export of the project will also be operated under the Jenkins user. (or modify the directory's permissions for the user with Administrator privileges)
3, the use of Jenkins is every user can use, so it is possible to cause the build version of the error, or honestly in the Jenkins user to operate it.
Test Jenkins installation success
Open the browser, enter http://localhost:8080, and if you can open Jenkins normally, the Jenkins installation succeeds.
2 Installing the Jenkins Plugin
There are quite a few plugins in Jenkins that use what tools to install what tools.
For example, we use SVN here, install the SVN plugin, if you use git to install GIT plug-ins.
Because I already have SVN installed, the process of installing the plugin is shown in Git.
Install the plugin first step. png
Install the plug-in step two. png
Step three, search, install plugins. png
The fourth step, the installation process. png
Fifth step, view the installed plugins. Png3 Xcode and develop certificate settings
Because you want to use the Xcode command, you must ensure that Xcode command line is installed.
3.1 Setting up an Apple development certificate
In the original Xcode development under the user, export the publishing certificate, if you want to hit the Enterprise package (299 knives) and the company/personal version of the package (99 knives), then the two certificates are exported, and then copied to the Jenkins user environment, double-click installed in the Mac keychain.
Certificate settings The first step. png
Certificate settings Step two. png
Note: Because user access to the certificate in the keychain requires permissions, while using Jenkins to build, whether using the Xcode plug-in configuration or shell script, can not enter the user password, so you must set the certificate "Access control" to allow all applications to access this project.
3.2 Installing the mobileprovision description file
The same needs to be installed under the Jenkins user, packaging needs of the phone description file.
4 Configuring the Build Project
Here's how to build a project, either using a local project or using a project on SVN (just fill in the SVN project address) and then enter the shell script to start the build.
4.1 Building with local projects
The steps are as follows:
Configuration item, first step. png
Click OK and the Hellojenkins directory will be generated under the "/user/Shared/jenkins/home/jobs" directory.
Configuration item Second step. png
Configure the third step. png
Other settings are not set, only need to set the next script, the script detailed content is as follows:
# project Name App_name="Hellojenkins"# certificate Code_sign_distribution="IPhone distribution:xxxxxxxxxxxx"# Info.plist Path project_infoplist_path="./${app_name}/info.plist "#取版本号bundleShortVersion =$ (/usr/libexec/plistbuddy-c"Print Cfbundleshortversionstring""${project_infoplist_path} ")#取build值bundleVersion =$ (/usr/libexec/plistbuddy-c"Print Cfbundleversion""${project_infoplist_path} ") date="$ (date +%y%m%d) "Ipaname="${app_name}_v${bundleshortversion}_${date}.ipa "echo "=================clean=================" Xcodebuild- Target "${app_name}"-configuration ' Release ' Cleanecho "+++++++++++ ++++++build+++++++++++++++++ "Xcodebuild-target " ${APP_ NAME} "-sdk iphoneos-configuration ' Release ' code_sign_identity= "${code_sign_distribution}" symroot= ' $ (PWD) ' Xcrun-sdk iphoneos packageapplication '. Release-iphoneos/${app_name}.app "-O ~/" ${ipaname}"
Note 1: "-o ~/$IPANAME" means that the exported IPA file is under the current user's directory, i.e. under "/user/Shared/jenkins/".
where code_sign_identity= "IPhone distribution:xxxxxxxxxx" is the common name used in your keychain for your packaged certificate.
The exported IPA, called "Hellojenkins_v1.2_20160118.ipa".
NOTE 2: If you like "Configure Item second step. png", in the same directory xcodeproj, create a new SH script file, with the "Sh xxx.sh" command, see the next article.
If you use Cocoapods in your project, the script has several parameters that need to be adjusted, as detailed in the next article.
Note 3 (2016.02.17 update): code_sign_identity This property can not be set, directly set the profile can be, compile automatically to match the corresponding code_sign_identity, it is necessary to note that when setting the profile, Set the value of its UUID. For example "provisioning_profile= ' F035763e-e847-4db8-ac10-0004809fdc90 '"
Click Save, then click on the left menu to build now and start building.
Build. PNG now
Build succeeded. png
Build the results. png4.2 using SVN address building
The first step, the new project, the same as above.
The second step, do not copy the project to the jobs directory, directly in the configuration of the source control that column set SVN address
SVN config. png
The third step is to set up the shell script as above.
Fourth step, build now.
Wen/haley_wong (author of Jane's book)
Original link: http://www.jianshu.com/p/c0955ff67c91
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".
Mac under Jenkins+svn+xcode build continuous