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

Tailored Fastlane

Tailored Fastlane

Learn how to customize Fastlane creating your own actions

https://github.com/fjcaetano/talks

Avatar for Flávio Caetano

Flávio Caetano

April 05, 2018
Tweet

More Decks by Flávio Caetano

Other Decks in Programming

Transcript

  1. 1. Run tests 2. Select certificates 3. Archive ipa 4.

    Capture screenshots 5. Upload to iTunes Connect 6. Notify on Slack
  2. 1. Run tests 2. Select certificates 3. Archive ipa 4.

    Capture screenshots 5. Upload to iTunes Connect 6. Notify on Slack $ fastlane ios deploy
  3. 1. Run tests 2. Select certificates 3. Archive ipa 4.

    Capture screenshots 5. Upload to iTunes Connect 6. Notify on Slack $ fastlane ios deploy 1. run_tests(scheme: “Tests”) 2. match(type: “distribution”) 3. build_app(scheme: “App”) 4. capture_screenshots 5. deliver 6. slack(message: “!”)
  4. desc "Runs all the tests" lane :test do run_tests( ...

    devices: [ "iPhone X (11.2)", "iPhone 7 (10.3)", "iPhone SE (9.0)", ] ... ) end
  5. desc "Runs all the tests" lane :test do run_tests( ...

    devices: [ "iPhone X (~> 11.2)", "iPhone 7 (^ 10.3)", "iPhone SE (== 9.0)", ] ... ) end
  6. def select_similar_simulator(args) args.map { |device_string| pieces = device_string.split(' (') FastlaneCore::Simulator.all

    .select { |s| s.name == pieces.first } .sort_by { |s| Gem::Version.create(s.os_version) } .detect { |s| Gem::Requirement.new(pieces[1].tr('()', '')) .satisfied_by?(Gem::Version.create(s.os_version)) } } .compact .map { |s| "#{s.name} (#{s.ios_version})"} end
  7. desc "Runs all the tests" lane :test do run_tests( ...

    devices: self.select_similar_simulator([ "iPhone X (~> 11.2)", "iPhone 7 (~> 10.3)", "iPhone SE (~> 9.0)", ]) ... ) end
  8. class MyAction < Action def self.run(params) def self.available_options def self.output

    # docs def self.return_value def self.description def self.details def self.authors def self.category def self.is_supported?(platform)
  9. class SpmAction < Action def self.run(params) cmd = [“swift”] cmd

    << "--build-path #{params[:build_path]}" if params[:build_path] cmd << "--package-path #{params[:package_path]}" if params[:package_path] cmd << "--configuration #{params[:configuration]}” if params[:configuration] cmd << "--verbose" if params[:verbose] cmd << params[:command] sh(cmd) end
  10. def self.available_options [FastlaneCore::ConfigItem.new(key: :configuration, env_name: “FL_SPM_CONFIGURATION", description: "Build with configuration

    (debug|release) [default: debug]”, optional: true, verify_block: proc do |value| UI.user_error!("Please pass a valid configuration: (debug|release)”) unless valid_configurations.include?(value) end), ... ] end def self.valid_configurations [“debug”, “release”] end