Upgrade to Pro — share decks privately, control downloads, hide ads and more …

從獨立開發到大型專案的CI/CD攻略

Hokila Jan
November 08, 2020

 從獨立開發到大型專案的CI/CD攻略

Hokila Jan

November 08, 2020
Tweet

More Decks by Hokila Jan

Other Decks in Programming

Transcript

  1. shell script function build_product() { ProductPostfix=$1 XcodeConfiguration=$2 removeLastBuild setNewBuildNumber generateparameter

    archive upload #to TestFlight or OTA service notify } eval "$1" # sh buildScript.sh "build_product AppStore PROD" # sh buildScript.sh "build_product AdHoc UAT"
  2. shell script function archive() { xcodebuild clean archive\ -archivePath "build/prod_$scheme/$scheme"\

    -workspace $XcodeWorkspaceFile\ -scheme "$scheme" | xcpretty xcodebuild -exportArchive\ -archivePath "build/prod_$scheme/$scheme.xcarchive"\ -exportPath "build/prod_$scheme/$scheme"\ -exportOptionsPlist $exportPlist | xcpretty }
  3. shell script function archive() { eval "fastlane gym \ --workspace

    $XcodeWorkspaceFile \ --scheme $XcodeScheme \ --clean \ --configuration $XcodeConfiguration \ --output_name $ipaFileName \ --include_bitcode YES \ --export_method $ExportMethod " }
  4. lane :matchAll do match(type: "appstore", app_identifier: [ "com.starlux.cale", "com.starlux.cale.notificationService"], readonly:

    true) match(type: "development", generate_apple_certs: false, force:true, force_for_new_devices: true, app_identifier: [ "com.starlux.cale.dev", "com.starlux.cale.dev.notificationService", "com.starlux.cale", "com.starlux.cale.notificationService" ], readonly:false) end
  5. desc "Archive" lane :archive_app do |options| cocoapods increment_build_number( build_number: ENV['BUILD_NUMBER'],

    # set a specific number ) #match certificate and provision file case ENV['ARCHIVE_TYPE'] when 'app-store' match(type: "appstore", app_identifier: ["com.starlux.cale", "com.starlux.cale.notificationService"], readonly: true) ………
  6. % bundle exec fastlane archive_app --env dev # .env.dev (committed

    to version control) ARCHIVE_TYPE=development BUILD_CONFIGURATION=DEV APPCENTER_NAME=<secret> APPCENTER_GROUP=<another secret>
  7. 更懶惰一點? - 有 merge request 就跑 unit test,成功按讚 - Develop

    branch 有更新就 build 一版測試版 - 有新的 tag 就 build 一版送審
  8. 要從安裝 command line 開始 ‣ bundle install ‣ pod install

    ‣ fastlane plugin ‣ DerivedData? Cloud CI 共同缺點-沒有 cache 真的很久
  9. 如何加速 Build Time! ‣ 除了換機器以外 ‣ Optimize Build Setting ‣

    Prebuild code into library/framework ‣ Cocoapods-binary or Carthage