Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

40
Apply CI tools in iOS development Khoi M. Truong Innovatube

Transcript of Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Page 1: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

ApplyCItoolsiniOSdevelopment

KhoiM.TruongInnovatube

Page 2: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Strategies

Page 3: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastlane

• Automatetasks• Pipeline

lane :beta doincrement_build_numbercocoapodsmatchtestflight sh "./customScript.sh”slack

end

Page 4: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Whyfastlane?

• Oneworkflow

Page 5: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Whyfastlane?

• Differentlanesforeachstrategies

lane :test doscan

end

lane :beta doscanpemmatchgympilotslack

end

Page 6: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Whyfastlane?

• Deployfromanywhere(local,CIserver,...)• Customizable,easytoextend• StoreeverythinginGit• Over170built-inintegrationsavailable• Gooddocumentations• …

Page 7: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastlanetoolchain

• deliver• snapshot• pem• sigh• cert• spaceship• pilot• boarding• gym• match• scan

Page 8: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi
Page 9: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Demo

Page 10: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Install

sudo gem install fastlane -verbose

xcode-select -install

gem cleanup

Page 11: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Init

fastlane init

Page 12: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Commands

fastlane beta

fastlane appstore

fastlane test

Page 13: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Actions

scan

increment_build_number

pem

match

gym

Page 14: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Actions

Additional actionshttps://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

Page 15: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

Page 16: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

• Ruby

fastlane_version "1.98.0”default_platform :ios

Page 17: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

platform :ios do# Do something

end

Page 18: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

before_all doENV["DEVELOPER_DIR"] = "/Applications/Xcode.app"

end

Page 19: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

lane :beta doscan(scheme: "Beta",device: "iPhone 6s”

)end

Page 20: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Fastfile

lane :test doscan

end

lane :beta doscan( # Command namescheme: "Beta", # Parameterdevice: "iPhone 6s”

)end

Page 21: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Appfile

app_identifier "com.khoitm.AlaskaRiver"apple_id "[email protected]"team_id "ABCD1234”

identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)

Page 22: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Staticanalysis

brew install swiftlint

# Configurations.swiftlint.yml

Page 23: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Staticanalysis

swiftlint(mode: :lint,output_file: 'swiftlint.result.json', config_file: '.swiftlint.yml', ignore_exit_status: true

)

Page 24: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

• Unittesting• Testreport• Slacknotification• Scanfile

Page 25: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

• Unittesting• Runtestsonmulti-device• Testreport• Slacknotification• Scanfile

Page 26: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

• Pushnotificationprofiles• Generate• Maintain

Page 27: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

1. CreateGitrepotostoreprofiles(certificates,provisions,…)2. Createprivatekeysandcertificatesfor“Distribution”and

“Development”.3. Createprovisioningprofilesfortargets

• Development• AppStore• Adhoc

4. EncryptcertificatesandprovisioningprofileswithOpenSSL5. AccessGitrepofromeachmachinetogetcertificatesand

profiles6. ConfigXcodewithprofiles7. UpdateprofileswhenadddeviceinDevPortal

Page 28: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi
Page 29: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

match(type: "adhoc",app_identifier: app_identifier,git_url: https://some.git/repo/certificates

)

Page 30: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

• BuildiOS/macOSapps• 30%fasterthanshenzhen• Auto-genipaanddSYM• Gymfile• ArchiveaccessiblefromXcodeOrganizer

gym(scheme: "Beta")

Page 31: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi
Page 32: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

• Environmentvariables

ENV["DEVELOPER_DIR"] = "/Applications/Xcode7.app"

Page 33: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Betadistribution

crashlytics(crashlytics_path: './Pods/Crashlytics/', api_token: 12345678abc',build_secret: ’987654321edf',ipa_path: './AlaskaRiver.ipa',emails: ’[email protected]

)

Page 34: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

To-Dos

• IntergratewithJenkin orXcodeserver• UploadscreenshotsandAppinfotoiTunesConnectusingdeliver andsnapshot• Notifybetatestersandotherdevelopersusingslack• AutomateUItesting• Automatebuildingwithmulti-target:• Development• Alpha• Beta• Production

Page 35: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Othertools

• deliver:Uploadscreenshots,metadata,andyourapptotheAppStore• snapshot:AutomatetakinglocalizedscreenshotsofyouriOSapponeverydevice• pilot:ThebestwaytomanageyourTestFlighttestersandbuildsfromyourterminal• boarding:TheeasiestwaytoinviteyourTestFlightbetatesters• spaceship:RubylibrarytoaccesstheAppleDevCenterandiTunesConnect

Page 36: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Othertools

• circleci.com• buddybuild.com• travis-ci.org• greenhouseci.com• Jenkin

Comparations:http://www.mjdinteractive.com/picking-a-continuous-integration-platform-for-mobile-projects/

Page 37: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Buddybuild

Page 38: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Buddybuild

Free100%!

Page 39: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Reference

• https://fastlane.tools/• https://github.com/fastlane• https://codesigning.guide/• https://www.raywenderlich.com/116065/fastlane-tutorial-getting-started

Page 40: Tech Talk #5 : ApplyCI tools in iOSdevelopment - Trương Minh Khôi

Thanksforlistening!