Fastlane基礎介紹

Fastlane是什麼

  • Git地址: Fastlane
  • 文檔地址:Fastlane Documentandroid

    • Fastlane是一整套的客戶端CICD工具集合。Fastlane能夠很是快速簡單的搭建一個自動化發佈服務,而且支持Android,iOS,MacOS。
    • Fastlane命令執行的底層並非本身實現的,而是調用其餘的插件或者工具執行的。好比說打包,Fastlane中的gym工具只是xcodebuild工具的一個封裝,調用的其實仍是xcodebuild中的打包命令。
    • Fastlane自己沒有一套特殊語法,使用的Ruby語言。
    • Fastlane的插件工具叫作action,每個action都對應一個具體的功能

Fastlane安裝

一、安裝xcode命令行工具,在終端輸入:

xcode-select --install

二、安裝Fastlane,在終端輸入:

//方式一:Using RubyGems
 sudo gem install fastlane -NV
//方式二:Using Homebrew
 brew cask install fastlane

Fastlane初始化工程

一、進入工程的根目錄,在終端輸入Fastlane初始化命令:

sudo fastlane init

二、初始化完成後會要求選擇建立目的:

  • What would you like to use fastlane for?
      1. Automate screenshots
      1. Automate beta distribution to TestFlight
      1. Automate App Store distribution
      1. Manual setup - manually setup your project to automate your tasks

若是是要上傳AppleStore選3,若是是企業版選4ios

三、安裝驗證

  • 在fastlane文件中寫入:
default_platform(:ios)
platform :ios do
  desc "生成本地版本"
  lane :testabc do
    build_app(scheme: "ZEUS")
  end
end
  • 進入工程的根目錄,在終端輸入:
fastlane testabc desc:測試打包

Fastlane經常使用工具(action)

查詢action:

在命令行輸入:git

//查詢全部action
fastlane actions
//查詢制定action
fastlane action [action_name]

action分類:

  • Testing
Action Description Supported Platforms
scan Alias for the run_tests action ios, mac
slather Use slather to generate a code coverage report ios, mac
swiftlint Run swift code validation using SwiftLint ios, mac
xcov Nice code coverage reports without hassle ios, mac
sonar Invokes sonar-scanner to programmatically run SonarQube analysis ios, android, mac
oclint Lints implementation files with OCLint ios, android, mac
gcovr Runs test coverage reports for your Xcode project ios
lcov Generates coverage data using lcov ios, mac
appium Run UI test by Appium with RSpec ios, android
xctool Run tests using xctool ios, mac
run_tests Easily run tests of your iOS app (via scan) ios, mac
xcode_server_get_assets Downloads Xcode Bot assets like the .xcarchive and logs ios, mac
  • Building
  • Screenshots
  • Project
  • Code Signing
  • Documentation
  • Beta
  • Push
  • Releasing your app
  • Source Control
  • Notifications
  • App Store Connect
  • Misc
  • Deprecated

踩坑筆記

  • 1.報Missing Private Key:

    須要從有證書的Mac中導入證書的p12私鑰安裝到新的打包機github

  • 2.在compiling Swift source files這一步不再動了:

    Project --> Build Settings --> Swift compiler-code generation 找到Optimization Level 將其設置爲No optimization[-Onone]swift

相關文章
相關標籤/搜索