Continuous Integration in the Client Side Using Xcode Server
Check out a tutorial that explains how to set configurations of Xcode Server in Xcode to use in the client side.
Join the DZone community and get the full member experience.
Join For FreeThis article will guide you in setting configurations of XCode Server in Xcode to use in the client side. Client-side configuration might be quite handy if your company has a restricted web access policy from servers. All team members need to do the same configuration. At the end of the tutorial, we will have a continuous integration system with the following features:
Code static analysis and warning monitoring
Unit test runs
Code coverage measurement
Integration start options with manual, on every commit or by schedule
Incrementing build number and pushing into Git repo
Uploading app to Diawi and emailing to the testers
Firstly, the client should be set as Xcode Server with the following steps:
Open XCode -> Preferences -> Server&Bots
After turning XCode Server on, add this server into the xcode accounts:
Open XCode -> Preferences -> Accounts
Now you can add as many bots as you want. Bots may differ with their target git branches or their build configuration like Debug, Enterprise, or AppStore.
Select XCode -> Product -> Create Bot
After creating the bot, clicking on the integrate button starts the process. At the end of the process, the report overview screen displays the results. Each build needs a different build number. Since we are running the integration on the client side, we need to have a script that increments the build number and pushes it into a remote git repo to synchronize build numbers between team members. The script can be added as Archive Post Action:
Open Edit Scheme -> Archive -> Post-actions and select new run script action and add following script:
if [ "the$XCS_INTEGRATION_NUMBER" == "the" ]; then
echo "Not an integration build…"
else
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
# increment the build number (ie 115 to 116)
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
buildnum=$(expr $buildnum + 1)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnum" "${plist}"
echo "Bumped build number to $buildnum"
echo "Committing the build number..."
cd ${PROJECT_DIR};git add src/Info.plist
cd ${PROJECT_DIR};git commit -m "Bumped the build number for test version."
cd ${PROJECT_DIR};git push -u
echo "Build number committed."
fi
There are many continuous integration tools for iOS, but XCode Server is a native continuous integration service, so you do not depend on third-party frameworks. It is supported by Apple and running unit tests and managing certificates are very compatible with XCode development environments.
Opinions expressed by DZone contributors are their own.
Comments