Ci system part i
Transcript of Ci system part i
(CI System) -
Enoch Lee
Github
Social
https://github.com/ChenWeiLee
https://www.facebook.com/profile.php
iOS 2 Objective-C
Swift
Clean Code SVM
Enoch Lee
Build Machine,
1. - CI
2. - Jenkins
3. - Jenkins
4. - Shell Script
5. - Shell Script
- CI
- 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?
- 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
- CI III
• CI
• Jenkins CI• Travis CI• Hudson CI• Circle CI
Jenkins Jenkins Jenkins
- Jenkins
- Jenkins
- Jenkins I• 安裝完Jenkins後,Jenkins會⾃動幫你新增⼀個使⽤者,要操作的話建議登入此使⽤者中做操作。
• 進入"管理Jenkins” —> “管理外掛程式” 去下載需要⽤到的外掛,下載完後重啟Jenkins Server。
• 我們會使⽤到的外掛• Xcode integration• GIT plugin
- Jenkins II• -
• Free-Style
•
- Jenkins III• Git
• Repository Url
•Credentials git gitlab
•Branches to Build
- Jenkins IV•
•
•
•
- Shell Script
- Shell Script I•Shell script Command line(terminal ) ”.sh”
Shell script
•Comment line ”cd /bin”
Xcode Command line Build Script
•Xcode
•Xcrun
•XcodeBuild
- 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
- Shell Script
- Shell Script I•
• Xcode Shell
• Shell
• ” ”
- Shell Script II• Jenkins Pull Branch Code Build
• Shell Script Push Git Jenkins
• Shell script
- Shell Script III• Keychin Shell script
• Key ” ”
• Shell script
security unlock-keychain -p "$ "
- Shell Script IV• Shell Script “Scheme” Xcode Share
Jenkins Scheme
- 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
… 2,678,400 sec