In iOS development, packaging is a tedious and time-consuming process, so I will talk about how to use Jenkins to achieve automatic continuous integration. You can install Jenkins by typing $brew install Jenkins. If you don’t have brew, you can install Jenkins by yourself

The following are errors that you may encounter during installation: Java environment errors

Jenkins: Java 1.8 is required to install this formula. JavaRequirement unsatisfied! You can install with Homebrew Cask: brew cask install homebrew/cask-versions/java8 You can download from: https://www.oracle.com/technetwork/java/javase/downloads/index.html Error: An unsatisfied requirement failed this build.Copy the code

$brew cask install Caskroom /versions/java8 = $brew cask install Caskroom /versions/java8

java8 was successfully installed!
Copy the code

Once the Java installation is complete, type $brew Install Jenkins again to install

Note: When using launchctl the port will be 8080.
To have launchd start jenkins now and restart at login:
  brew services start jenkins
Or, if you don't want/need a background service you can just run: Jenkins = = > the Summary 🍺 / usr/local/Cellar/Jenkins / 2.170: 7 Files, 77.3MB, built in 20 secondsCopy the code

This will indicate that Jenkins is already installed. The beer will be followed by the installation path. The default port is 8080

Jenkins configuration

1. Modify the default port
$ vim /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist
Copy the code
<? xml version="1.0" encoding="UTF-8"? > <! DOCTYPE plist PUBLIC"- / / / / DTD PLIST Apple 1.0 / / EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <dict> <key>Label</key> <string>homebrew.mxcl.jenkins</string> <key>ProgramArguments</key> <array> < string > / usr/libexec/java_home < / string > < string > -v < / string > < string > 1.8 < / string > < string > - exec < / string > <string>java</string> <string>-Dmail.smtp.starttls.enable=true</string>
                <string>-jar</string>
                <string>/usr/local/ opt/Jenkins/libexec/Jenkins. War < / string > < string > - httpListenAddress = 127.0.0.1 < / string > <string>--httpPort=8090</string> </array> <key>RunAtLoad</key> <true/>
</dict>

Copy the code
2. Jenkins start & Close & Restart
$ brew services start jenkins
==> Successfully started `jenkins` (label: homebrew.mxcl.jenkins)
$ brew services stop jenkins
==> Successfully stopped `jenkins` (label: homebrew.mxcl.jenkins)
$ brew services restart jenkins
==> Successfully started `jenkins` (label: homebrew.mxcl.jenkins)
Copy the code
3. Jenkins website configuration

After the Jenkins service starts, type http://localhost:8090 in your browser

Follow the instructions on the page to find the Jenkins unlock password and enter it and continue. Initialization may take some time. Be patient

You might have a Jenkins offline problem, Here to provide a solution for $vim ~. Hudson/Jenkins. Model. UpdateCenter. Replace XML Url for mirrors.tuna.tsinghua.edu.cn/jenkins/upd…

After the initialization is successful, install the recommended plug-in. After the plug-in installation is complete, go to the following page and create a user as prompted

After the user is created, enter Jenkins server address configuration. If it is not an independent server, ignore this step

Tip If the instance configuration is blank and the refresh is invalid, open the terminal and restart Jenkins

4. Plug-in installation required for iOS persistent integration

Enter plug-in management, select optional plug-in options, and search the plug-in we need to install in the search bar. Plug-in installation is a long process to wait patiently

Here are a few names of plug-ins needed for iOS automation, • Keychains and Provisioning Profiles Management • Xcode Integration • Upload to PGyer (Upload dandelion platform plug-in)

At this point, the Jenkins environment for continuous integration is completed

The next step is to configure Jenkins to complete iOS automation packaging and iOS persistence integration.