Continuous integration solution

  • Jenkins + Fastlane
  • gitlab + Fastlane

1.Jenkins + Fastlane

Reference: https://www.jianshu.com/p/ae5b492b5338Copy the code

2.gitlab + Fastlane

1. Download and install GitLab Runner

- refer to https://docs.gitlab.com/runner/install/Copy the code

2. Download and install Fastlane

- https://docs.fastlane.tools/getting-started/ios/setup/ - CD to the working directory fastlane init the current path will be a fastlane /, there are two configuration files, Appfile and FastfileCopy the code

3. Configure fastLane automatic packaging

Default_platform (:ios) Platform :ios do desc "Push a new beta build to TestFlight" before_all do # Configure special password to skip Apple secondary authentication ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = "XXXXXXX" desc "pod install" end #  sigh(adhoc:true,force:true) cocoapods(verbose:true,use_bundle_exec:false,try_repo_update_on_error:true,podfile: "Podfile") build_app(workspace: "xxxx.xcworkspace", scheme: "xxxxx",clean:true,export_method: "ad-hoc") pgyer(api_key: "xxxxx", user_key: Lane: Tests do cocoapods(verbose:true, use_bundLE_exec :false,try_repo_update_on_error:true,podfile:  "Podfile") run_tests( workspace: "xxxx.xcworkspace", scheme: "xxxxTest", devices: ["iPhone 8"], clean:true, fail_build:false, code_coverage:true, reinstall_app:true, app_identifier:"com.xxxx.xxxx", Output_types :" HTML ", output_files: "xxxxtest.html ") end # Calculate the utility coverage lane :test_xcov do xcov(workspace: "xxxx.xcworkspace", scheme: "xxxxTest", output_directory: "fastlane/xcov_output", markdown_report:true, include_test_targets:true, TestFlight lane :beta_Testflight do cert log build_app(workspace: "xxxx.xcworkspace", scheme: "xxxx",clean:true) ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t Aspera" upload_to_testflight(skip_waiting_for_build_processing:true) end endCopy the code

4. Configuration. Gitlab – ci. Yml

stages: - pgyer - unitTest - testFlight variables: LANG: "en_US.UTF-8" LANGUAGE: "en_US.UTF-8" LC_ALL: "en_US.UTF-8" pgyer_job: stage: pgyer script: - fastlane init - fastlane pgyer_Hoc tags: - app_runner only: - develop tests_job: stage: unitTest script: - fastlane init - fastlane tests - fastlane test_xcov - ./auto-dev.sh tags: - app_runner only: - develop testFlight_job: stage: testFlight script: -fastlane init -fastlane beta_Testflight -./ auto-. sh # Run the script to send pin notifications, email notifications, etc. Tags: -app_runner only: -release_buildCopy the code

5. Difficulties of Apple continuous integration

1. To avoid the need to apply for a special password on apple development platform for two-step authentication, you need to use the environment variable FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD to provide this application Specific password.  - Run fastlane spaceauth -u [email protected] to generate session cookies. - Provides session cookies through the FASTLANE_SESSION environment variable. Configure the environment variable vim ~/. Bash_profile. 2Copy the code

reference

- https://www.jianshu.com/p/19ae8cc865b0
- https://segmentfault.com/a/1190000011717578?utm_source=tuicool&utm_medium=referral
Copy the code