Ci system part i

26
瞱媲碉ݳ羬翄(CI System) - ᒫӞᒍ ἓ碻դ Enoch Lee
  • Upload

    -
  • Category

    Software

  • view

    854
  • download

    0

Transcript of Ci system part i

Page 1: Ci system part i

(CI System) -

Enoch Lee

Page 2: Ci system part i

Github

Social

https://github.com/ChenWeiLee

https://www.facebook.com/profile.php

iOS 2 Objective-C

Swift

Clean Code SVM

Enoch Lee

Page 3: Ci system part i

Build Machine,

1. - CI

2. - Jenkins

3. - Jenkins

4. - Shell Script

5. - Shell Script

Page 4: Ci system part i

- CI

Page 5: Ci system part i

- CI I• CI Server Continuous Integration Server ( )

Build code ... QA

• CI Server

CI Server Check In

CI Server !Build

CI Server Check In

CI Server

Routing Deploy

CI Server 02 - CI Server?

Page 6: Ci system part i

- CI II•CI

1. Build Code Testing code

/ code QA

2. Web QA PM QA

code

3. Unit Testing UI Testing Build Code CI RD

or QA

4. Testing

Page 7: Ci system part i

- CI III

• CI

• Jenkins CI• Travis CI• Hudson CI• Circle CI

Jenkins Jenkins Jenkins

Page 8: Ci system part i

- Jenkins

Page 9: Ci system part i

- Jenkins I

• Java

• Java Jenkins

• OS

Page 10: Ci system part i

- Jenkins II

安裝完成後,使⽤瀏覽器開啟 http://localhost:8080/ ,如果能夠看到以下就表⽰已安裝完成

Page 11: Ci system part i

- Jenkins

Page 12: Ci system part i

- Jenkins I• 安裝完Jenkins後,Jenkins會⾃動幫你新增⼀個使⽤者,要操作的話建議登入此使⽤者中做操作。

• 進入"管理Jenkins” —> “管理外掛程式” 去下載需要⽤到的外掛,下載完後重啟Jenkins Server。

• 我們會使⽤到的外掛• Xcode integration• GIT plugin

Page 13: Ci system part i

- Jenkins II• -

• Free-Style

Page 14: Ci system part i

- Jenkins III• Git

• Repository Url

•Credentials git gitlab

•Branches to Build

Page 15: Ci system part i

- Jenkins IV•

Page 16: Ci system part i

- Shell Script

Page 17: Ci system part i

- Shell Script I•Shell script Command line(terminal ) ”.sh”

Shell script

•Comment line ”cd /bin”

Xcode Command line Build Script

•Xcode

•Xcrun

•XcodeBuild

Page 18: Ci system part i

- Shell Script II•Shell script

shell script ”.sh”

Shell script

•Shell script

command line cd .sh ”sh shell_script .sh” Shell script

•Shell script

Shell script ”sh shell_script .sh”

Ex ”sh shell_script .sh 1 2 3”

Shell script Shell script “$”

Ex $1 = 1 $2 = 2 $3 = 3

Page 19: Ci system part i

- Shell Script

Page 20: Ci system part i

- Shell Script I•

• Xcode Shell

• Shell

• ” ”

Page 21: Ci system part i

- Shell Script II• Jenkins Pull Branch Code Build

• Shell Script Push Git Jenkins

• Shell script

Page 22: Ci system part i

- Shell Script III• Keychin Shell script

• Key ” ”

• Shell script

security unlock-keychain -p "$ "

Page 23: Ci system part i

- Shell Script IV• Shell Script “Scheme” Xcode Share

Jenkins Scheme

Page 24: Ci system part i

- Shell Script V# $1:PROJECT_NAME $2:SDK $3:PROJECT_SCHEMA $4:BuildConfiguration $5:Password

if [ "$(ls -A Xcarchive)" ] then echo "Have Xcarchive" else mkdir Xcarchive fi

security unlock-keychain -p "$5"

xcodebuild -archivePath "$WORKSPACE/Xcarchive/${JOB_NAME}_${BUILD_NUMBER}.xcarchive" -project $1.xcodeproj -sdk $2 -scheme $3 -configuration $4 archive

if [ "$(ls -A Ipa)" ] then echo "Have Ipa" else mkdir Ipa fi # Export Archive project xcrun -sdk $2 PackageApplication -v "${WORKSPACE}/Xcarchive/${JOB_NAME}_${BUILD_NUMBER}.xcarchive/Products/Applications/$1.app" -o $WORKSPACE/Ipa/${JOB_NAME}_${BUILD_ID}.ipa # #xcodebuild -exportArchive -exportFormat IPA -archivePath "${xcarchive }"/"${xcarchive }".xcarchive -exportPath "${ipa }"/"${ ipa }".ipa

Page 25: Ci system part i

… 2,678,400 sec

Page 26: Ci system part i