Macの下、iOS jenkins+fastlane+三方託管サイト、持続可能な統合埋め込み

2861 ワード

Jenkinsのインストールについては、以下を参照してください.https://www.jianshu.com/p/41ecb06ae95f# fastlaneの流れについては、以下を参照してください.https://www.jianshu.com/p/7b73eef0d140
持続可能な統合の手順:
  • Jenkinsは構築サービスとしてサーバ上で
  • を実行する.
  • gitlabまたは他のサーバは、コードソース(トリガ制御の構築)
  • として機能する.
  • Jenkinsサーバの実行ディレクトリにコードをロードする
  • はJenkins構築ステップ(主にshellを実行する)を実行し、この部分は主に環境切替、静的分析とテストスクリプト実行、および構築スクリプト実行などであり、この部分fastlaneは主力軍として構築のステップを大幅に簡素化することができる.
  • Jenkins構築後の操作(多くはアーカイブ、メール通知など)
  • 遭遇した穴:
    rvmとrubyはロードされず、command not foundがエラーを報告しました.
    Jenkinsは構築を開始する時、現在の環境変数を構成していないで、PATHはrubyがロードしていないことを招いて、多くのライブラリが探し出せないで、特にfastlaneこの時に自機の上でcommand lineに上陸してecho $PATHを実行して、それを複製して、Jenkins管理ページの中で配置して、サブノードの下で:keyはPATHで、valueはecho $PATHの結果です
    キーストロークパーミッションエラー
    security unlock-keychain -p edu100 login.keychain-db
    security set-keychain-settings -t 3600 -l ~/Library/Keychains/login.keychain-db
    

    最後にfastlaneのスクリプトを差し上げます.
    # This file contains the fastlane.tools configuration
    # You can find the documentation at https://docs.fastlane.tools
    #
    # For a list of all available actions, check out
    #
    #     https://docs.fastlane.tools/actions
    #
    # For a list of all available plugins, check out
    #
    #     https://docs.fastlane.tools/plugins/available-plugins
    #
    
    # Uncomment the line if you want fastlane to automatically update itself
    # update_fastlane
    
    #    xcodebuild -showBuildSettings timed-out after 10 seconds and 3 retries. You can override the timeout value with the environment variable FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT, 
    # and the number of retries with the environment variable FASTLANE_XCODEBUILD_SETTINGS_RETRIES
    ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "180"
    ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "180"
    
    
    default_platform :ios
    
    platform :ios do
      before_all do
      # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
      match
      end
    
      desc "Runs all the tests"
      lane :test do
        
      end
    
      desc "      Beta    firim"
      lane :young_develop do
        
        #   build  
        increment_build_number
    
        #            
        # match
        
        #     archive   。    :appstore, ad-hoc, package, enterprise, development, developer-id
        ipa_name = "young_jenkins-#{Time.new.strftime("%Y%m%d-%h%M")}"
        build_ios_app(
            export_method: development, 
            output_name: ipa_name, 
            scheme: young
        )
    
        #   Fir
        firim(
            firim_api_token: "4f2d5738a05d7a0cfd7dd7ac69b40436", 
            ipa: ipa_name
        )
    
    end
    
      #  lane      
      after_all do |lane|
        # slack(
        #    message: "Successfully deployed new App Update."
        # )
      end
    
      #                
      error do |lane, exception|
        # slack(
        #   message: exception.message,
        #   success: false
        # )
      end
    end