Slide 1

Slide 1 text

iOS։ൃͱGitLab CI 2017/04/11 GitLab Meetup Tokyo #2 #gitlabjp

Slide 2

Slide 2 text

ࣗݾ঺հ • ӿຊ ݈ଠ • iOSΤϯδχΞ@iRidge, Inc. • Twitter: @enomotok_ • GitHub: k-enomoto

Slide 3

Slide 3 text

ࠓ೔࿩͢͜ͱ • iOS։ൃͷݱ৔ʹGitLab CIΛಋೖͨ͠࿩ • GitLab CIͰղܾͨ͠໰୊ • GitLab CIͷઃఆํ๏ for iOS

Slide 4

Slide 4 text

iOS։ൃݱ৔Ͱͷ໰୊ • Ϗϧυͷ௨Βͳ͍ϓϩδΣΫτ

Slide 5

Slide 5 text

iOS։ൃݱ৔Ͱͷ໰୊ • Ϗϧυͷ௨Βͳ͍ϓϩδΣΫτ

Slide 6

Slide 6 text

iOS։ൃݱ৔Ͱͷ໰୊ • ࠶ݱੑͷͳ͍खಈϏϧυ $ xcodebuild -scheme Foobar archive -archivePath Foobar -configuration "Debug" $ xcodebuild -exportArchive -exportOptionsPlist exportOptionsDev.plist - archivePath "Foobar.xcarchive" -exportPath "artifacts"

Slide 7

Slide 7 text

iOS։ൃݱ৔Ͱͷ໰୊ • ʮ͜ͷipaͷ޲͖ઌͬͯ։ൃ؀ڥ͚ͩͬʁʯ

Slide 8

Slide 8 text

iOS։ൃݱ৔Ͱͷ໰୊ • CIͷͳ͍؀ڥͰ։ൃ͢Δෆ҆
 - Ϗϧυ͸յΕ͍ͯͳ͍͔
 - Ϣχοτςετ͸յΕ͍ͯͳ͍͔ • ຖճipa࡞Δͷ໘౗


Slide 9

Slide 9 text

GitLab CI

Slide 10

Slide 10 text

GitLab CI • GitLabʹ෇ଐ͍ͯ͠ΔCIπʔϧ • CircleCI, Travis CIΈ͍ͨͳ΋ͷ • .gitlab-ci.yml • ؆୯ʹಋೖՄೳ

Slide 11

Slide 11 text

• ߏ੒ GitLab CI ɾBSUJGBDUT QVTIΛݕ஌ HJUQVTI Developer Build Machine(Mac) ɾϏϧυ݁Ռ

Slide 12

Slide 12 text

GitLab CI • Pipelines

Slide 13

Slide 13 text

GitLab CI • Pipeline

Slide 14

Slide 14 text

GitLab CI • Artifacts

Slide 15

Slide 15 text

GitLab CIͷಋೖํ๏ • Setting up GitLab CI for iOS projects
 https://about.gitlab.com/2016/03/10/ setting-up-gitlab-ci-for-ios-projects/

Slide 16

Slide 16 text

GitLab CIͷಋೖํ๏ • GitLab CIͰXcodeϓϩδΣΫτΛCI͢Δखॱ
 http://qiita.com/enomotok_/items/ 83935c1137203e1c2c0f • GitLab CIͰiOSΞϓϦΛϏϧυ͠ɺ
 ipaΛ഑෍͢Δ
 http://qiita.com/enomotok_/items/ 966144d6bc40ec093ac3

Slide 17

Slide 17 text

GitLab CIͷಋೖํ๏ 1. ϏϧυϚγϯͷηοτΞοϓ 2. XcodeϓϩδΣΫτͷઃఆ 3. .gitlab-ci.yml 4. ϦϙδτϦͷઃఆ

Slide 18

Slide 18 text

GitLab CIͷಋೖํ๏ 1. ϏϧυϚγϯͷηοτΞοϓ 2. XcodeϓϩδΣΫτͷઃఆ 3. .gitlab-ci.yml 4. ϦϙδτϦͷઃఆ

Slide 19

Slide 19 text

ϏϧυϚγϯͷηοτΞοϓ • Mac
 - Xcode
 - iOS Certificates
 - Provisioning Profiles • GitLab Runner • ϏϧυϚγϯ͕ͳͯ͘΋OK
 -> ͻͱ·ͣ։ൃػΛϏϧυϚγϯͱ݉༻ʹ

Slide 20

Slide 20 text

GitLab Runner • GitLabΛϙʔϦϯά • git pushΛݕ஌ͨ͠Β.gitlab-ci.ymlͷ
 εΫϦϓτΛ࣮ߦ͠ɺ݁ՌΛGitLabʹ௨஌ • GitLab CI Multi Runner͔Βվ໊

Slide 21

Slide 21 text

GitLab CIͷಋೖํ๏ 1. ϏϧυϚγϯͷηοτΞοϓ 2. XcodeϓϩδΣΫτͷઃఆ 3. .gitlab-ci.yml 4. ϦϙδτϦͷઃఆ

Slide 22

Slide 22 text

XcodeϓϩδΣΫτͷઃఆ • Shared
 Manage Schemes… -> SharedʹνΣοΫ
 {project_name}.xcodeproj/xcshareddata
 Λcommit


Slide 23

Slide 23 text

GitLab CIͷಋೖํ๏ 1. ϏϧυϚγϯͷηοτΞοϓ 2. XcodeϓϩδΣΫτͷઃఆ 3. .gitlab-ci.yml 4. ϦϙδτϦͷઃఆ

Slide 24

Slide 24 text

.gitlab-ci.yml GitLabCISandbox !"" .git !"" .gitignore !"" .gitlab-ci.yml !"" .swiftlint.yml !"" GitLabCISandbox !"" GitLabCISandbox.xcodeproj !"" GitLabCISandbox.xcworkspace !"" GitLabCISandboxTests !"" Podfile !"" Podfile.lock !"" Pods !"" README.md !"" exportOptionsAdHoc.plist !"" exportOptionsDev.plist #"" exportOptionsRelease.plist • ϓϩδΣΫτͷrootʹ.gitlab-ci.ymlΛ࡞੒


Slide 25

Slide 25 text

.gitlab-ci.yml stages: - test - build .job_template: &job_definition before_script: - export LANG=en_US.UTF-8 - security unlock-keychain -p $PASS_PHRASE /Users/$USER_NAME/Library/Keychains/login.keychain - export DEVELOPER_DIR=/Applications/Xcode8.app/Contents/Developer <தུ> build_dev: <<: *job_definition stage: build script: - xcodebuild -scheme {scheme_name} archive -archivePath {your_path} -configuration "Debug" - xcodebuild -exportArchive -exportOptionsPlist exportOptionsDev.plist -archivePath “{yours}.xcarchive” -exportPath "artifacts/dev" artifacts: paths: - artifacts when: manual <ҎԼུ>

Slide 26

Slide 26 text

.gitlab-ci.yml • stage
 ϏϧυͷεςʔδΛઃఆ • script
 ࣮ߦ͍ͨ͠εΫϦϓτΛهࡌ • artifacts
 GitLab͔ΒDL͍ͤͨ͞੒Ռ෺ͷύεΛࢦఆ

Slide 27

Slide 27 text

.gitlab-ci.yml • only
 master, developͳͲಛఆͷϒϥϯνͷΈͰεΫϦϓτΛ࣮ߦ • when
 manualΛࢦఆ͢ΔͱɺGUIૢ࡞ΛܖػʹεΫϦϓτΛ࣮ߦ • cache
 ಛఆͷσΟϨΫτϦ഑ԼΛΩϟογϡ • tags
 ϏϧυϚγϯͷࢦఆʹ࢖༻
 https://docs.gitlab.com/ce/ci/yaml/

Slide 28

Slide 28 text

GitLab CIͷಋೖํ๏ 1. ϏϧυϚγϯͷηοτΞοϓ 2. XcodeϓϩδΣΫτͷઃఆ 3. .gitlab-ci.yml 4. ϦϙδτϦͷઃఆ

Slide 29

Slide 29 text

ϦϙδτϦͷઃఆ • Specific Runners

Slide 30

Slide 30 text

ϦϙδτϦͷઃఆ • Secret Variables

Slide 31

Slide 31 text

GitLab CIͷಋೖํ๏ • GitLab RunnerͷηοτΞοϓ • XcodeϓϩδΣΫτͷઃఆ • .gitlab-ci.yml • ϦϙδτϦͷઃఆ ✅ ✅ ✅ ✅

Slide 32

Slide 32 text

GitLab CIͷಋೖํ๏ ઃఆͰ͖ͨ

Slide 33

Slide 33 text

໰୊ͩͬͨ͜ͱ • Ϗϧυͷ௨Βͳ͍ϓϩδΣΫτ • ࠶ݱੑͷͳ͍Ϗϧυ

Slide 34

Slide 34 text

໰୊Λղܾ • git pushͷ౓ʹϏϧυ, lint, Ϣχοτςετ • git pushͷ౓ʹipaΛੜ੒ • masterϒϥϯν΁ͷϚʔδͷ౓ʹ
 ϦϦʔεϏϧυ • artifactsʹ͸URL͕෇༩͞ΕΔͨΊڞ༗ָ͕

Slide 35

Slide 35 text

՝୊ • ͱ͸͍͑՝୊΋… • ϏϧυϚγϯͷXcodeͷόʔδϣϯ؅ཧ • Ϣχοτςετ͕ͨ·ʹࣦഊ • ূ໌ॻɺProvisioning Profilesͷ؅ཧ • ipaͷ഑෍

Slide 36

Slide 36 text

·ͱΊ • GitLab CIͰiOSϓϩδΣΫτΛखܰʹCI / CD • ܁Γฦ͠ͷ࡞ۀΛGitLab CIͰࣗಈԽ

Slide 37

Slide 37 text

We are hiring.