Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

MPD2011 | Александр Додатко "Процесс непрерывной интеграции для iOS проектов"


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

MPD2011 | Александр Додатко "Процесс непрерывной интеграции для iOS проектов"

  1. 1. Whats CoveredManaging shared projects with xCodeBuilding a project without xCode GUICreating “universal binary” librariesand frameworksDeploying projects and libraries for QA
  2. 2. More Fun for Developers Unit testing with GHUnit Using Hudson build server ( it has a Chuck Norris plug-in ) Running applications on simulator without xCode
  3. 3. A Build server shouldCheckout project sourcesRun a build scriptDeploy product archivesPublish test reports
  4. 4. A Build Script ShouldBuild main productsCreate *.ipa packages for main productsRun clang static analyzerBuild unit testsRun unit tests with iphonesimPackage *.ipa and *.app entries to *.zip archivePrepare unit test and clang reports fordeployment
  5. 5. Hudson CI quick startSICCI for Xcode Plugin – sicci_for_xcodeClang scan-build plug-in – clang-scanbuild-pluginTestflight Plugin – testflight Pros Cons Simple learning curve Scripting provides Easy to use more control and flexibility
  6. 6. “Commonly Used” Project Organization
  7. 7. Wrong !!!
  8. 8. ONE Product, ONE XCODE PROJECT
  9. 9. Library Project How-To
  10. 10. Library Project How-To
  11. 11. Setting up Dependencies
  12. 12. Creating Universal Binaries1. No need to open your source code.2. A better experience for library users1. Build a library version for the device.2. Build a library version for the simulator.3. Combine them to a single binary4. Deploy universal library to the “frameworks”directory.
  13. 13. Combining Binarieslipo -create"${LIB_BUILD_DIR}/Release-iphoneos/libCITest_Model_Universal.a""${LIB_BUILD_DIR}/Release-iphonesimulator/libCITest_Model_Universal.a"-output "../frameworks/CITest-Model-Universal/Lib/libCITest_Model_Universal.a"
  14. 14. Custom iOS framework : motivationA more native Apple wayVery easy to use and integrateNo source code disclosureIt may contain resources, just like the *.appFramework is an NSBundleFlexible versioning and dynamic load (Mac only)Requires more work to develop and deploy
  15. 15. Custom iOS frameworks 1. Yes. You can create and use them 2. For iOS they are linked statically only 3. Thats why they have only one versionMyFramework.framework|-------> MyFramework (universal static library)|------->Headers (symlink)|------->Resources (symlink, optional)|------->Versions Actual files should be here
  16. 16. Deployment : Desktop vs. Mobile
  17. 17. Desktop Applications *.app +
  18. 18. iOS Applications QA? *.ipa ?
  19. 19. Inside the *.ipa packageCITest.ipa (Zip archive)||---->Payload (a folder)| || | (Contains signature and provisioning)| |----->| | || | |----->CITest(.exe)| | |----->*.nib; *.strings; *.plist| | |----->*.jpeg; *.png; ….
  20. 20. Mobile QA *.ipa
  21. 21. Building Without xCode GUIxcodebuild -project CITest.xcodeproj-sdk iphonesimulator4.3-configuration Release-target CITest-parallelizeTargetsclean build
  22. 22. Selecting xCode installationGetting current xCode pathxcode-select -print-pathSwitching to a new onesudo xcode-select -switch <new path>Modify /etc/sudoers to get rid of password prompts
  23. 23. Creating Installable *.ipa File /usr/bin/xcrun -sdk iphoneos PackageApplication -v "${BUILD_DIR}/Release-iphoneos/" -o "${DEPLOYMENT_DIR}/CITest.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"DEVELOPER_NAME="iPhone Developer: Oleksandr Dodatko (ABCDEFG123456)"
  24. 24. For xCode4 and up/usr/bin/xcrun -sdk iphoneos PackageApplication-v "${BUILD_DIR}/Release-iphoneos/"-o "${DEPLOYMENT_DIR}/CITest.ipa"--sign "${DEVELOPER_NAME}" c c--embed "${PROVISIONING_PROFILE}"
  25. 25. How About Unit Testing?Picking a frameworkRunning a testCollecting results
  26. 26. Test Frameworks Chart SenTest Google GHUnitXcode integration + + ---UIKit Support --- --- +Bundles support --- --- +Xml reports --- --- + (lack of support for hudson CI)Runs on device +- +- + ( Runtime tests only ) ( Runtime tests only )Runs on simulator +- +- + ( logic tests only ) ( logic tests only )Debugging (out ofbox) --- --- +UI snapshotscomparing --- + ---
  27. 27. GHUnit ConfigurationAdd GHUnit.frameworkReplace Main.h with the one from GHUnitRemove “MainNibFile” entry from the info.plitsGHUNIT_AUTORUNWRITE_JUNIT_XMLGHUNIT_AUTOEXIT// Not supported in the official GHUNIT
  28. 28. Running a Testiphonesim launch"$DEPLOYMENT_DIR/"4.2ipadNOTE : Use only FULL PATH to the app as shown above
  29. 29. Collecting Test ResultsTEMP_DIR=$(/usr/bin/getconf DARWIN_USER_TEMP_DIR)All Test results are here :$TEMP_DIR/test-results
  30. 30. Terminating the Simulatorkillall -s -KILL -c "iphonesim"killall -KILL -c "iphonesim"killall -s -KILL -c "iPhone Simulator"killall -KILL -c "iPhone Simulator"Do it before you run a test app
  31. 31. Build and analyzeDownload and unzip clangUse scan-build commandscan-build -o TargetDir xcodebuild <just like for your usual builds>
  32. 32. Hudson plug-ins statisticsUnit tests trend Clang trend
  33. 33. Defining the Project Structure app lib frameworks scripts tools test certificates deployment
  34. 34. ContactsEPAM systems (Dnipropetrovsk) page : Dodatkomail/jabber : dodikk88.reg@gmail.comSkype : page :