Jenkins is a common-used open source continuous integration solution for many companies, it works well for a large range of projects, but Jenkins is not the first choice for Apple developers. Apple provided an independent CI server called Xcode Server which only works for Apple projects. But for many managers, it is always a better choice if there is an “one picture”solution which could settle all projects in a single CI server. And here is my solution to let the newest iOS projects (build by Xcode 6) work well in a Jenkins server.
Fist of all
This post assumes that you’ve already got a version control system up and running. If you haven’t please see my colleague’s related post:
Install java, brew,etc
To start the configuration, we need to install Java, brew on your mac first. Java is no longer installed on OS X by default, so please follow the link to install java.
After that, we need to install brew for the future configuration, follow the link to install brew.
Init a Jenkins server
First of all, you’ll have to install a Jenkins server in a Mac OS based computer. Download the newest version from Jenkins and install it.
After the installation, you need to run the following codes first to move the Jenkins folder to your personal folder, to make sure there is no “permission issues” in future.
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
And be sure to start the Jenkins server from command line every time, by using:
java -jar /Applications/Jenkins/jenkins.war –httpPort=8080
After Jenkins is fully boot up, visit it in your browser:
Install necessary plugins in Jenkins
Install plugins via “Manage Jenkins”—“Manage Plugins”—“Available” and here is my plugins list:
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
MapDB API Plugin
Static Analysis Collector Plug-in
Static Analysis Utilities
Configure a clang analyze plugin
For those who want to enable a static analyze function in Jenkins, we’ll have to do some hard-coding things to let an analyze adaptable for Xcode 6.
- Install maven:
Brew install maven
- Get the latest Clang Scan-Build Plugin from github:
git clone firstname.lastname@example.org:jenkinsci/clang-scanbuild-plugin.git
- Locate and open “clang-scanbuild-plugin/src/main/java/jenkins/plugins/clangscanbuild/commands/ScanBuildCommand.java”, and do something like this:
- Go back to the root folder of clang-scan, recompile the plugin with maven, and skip test to save time:
mvn -Dmaven.test.skip=true install
- Locate the new auto-created “target” folder, and find “clang-scanbuild-plugin.hpi” under the “target” folder, then copy it directly into Jenkins plugin folder (usually under “~/Users/YOUR-USER-NAME/.jenkins/plugins”), then restart Jenkins, go to the plugins page to check that your plugin is installed.
(select ’Manage Jenkins’ — ’Manage Plugins’ and click on the ’Installed’ tabs)
- Download & install the Clang Static Analyzer in your machine, then tell the Jenkins to install the clang static analyzer in the Jenkins settings tab (“Manage Jenkins”—“Configure System”—“Clang Static Analyzer” : clang-analyzer.llvm.org/downloads/checker-276.tar.bz2
Configure other plugins
For those guys who want to use the same plugins as I list above, good news for you, I’ve already written a script to configure, just type the following codes in your terminal and all done, cheers! XD
#install for junit
sudo gem install ocunit2junit
#install for code coverage check
git clone https://github.com/gcovr/gcovr.git
sudo cp ./gcovr/scripts/gcovr /usr/local/bin
sudo chown root:wheel /usr/local/bin/gcovr
sudo chmod 755 /usr/local/bin/gcovr
rm -rf ./gcovr/