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

Fastlane Sob Medida

Fastlane Sob Medida

Nesta talk, aprenderemos como tirar o máximo do Fastlane, explorando a biblioteca e criando as suas actions customizadas.

https://github.com/fjcaetano/talks

Avatar for Flávio Caetano

Flávio Caetano

April 18, 2018
Tweet

More Decks by Flávio Caetano

Other Decks in Programming

Transcript

  1. 1. Rodar testes 2. Selecionar certificados 3. Arquivar .ipa 4.

    Capturar screenshots 5. Enviar para iTunes Connect 6. Notificar no Slack
  2. 1. Rodar testes 2. Selecionar certificados 3. Arquivar .ipa 4.

    Capturar screenshots 5. Enviar para iTunes Connect 6. Notificar no Slack $ fastlane ios deploy
  3. 1. Rodar testes 2. Selecionar certificados 3. Arquivar .ipa 4.

    Capturar screenshots 5. Enviar para iTunes Connect 6. Notificar no Slack 1. run_tests(scheme: “Tests”) 2. match(type: “distribution”) 3. build_app(scheme: “App”) 4. capture_screenshots 5. deliver 6. slack(message: “!”) $ fastlane ios deploy
  4. desc “Roda todos os testes" lane :test do run_tests( ...

    devices: [ "iPhone X (11.2)", "iPhone 7 (10.3)", "iPhone SE (9.0)", ] ... ) end
  5. desc "Roda todos os testes" 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 "Roda todos os testes" 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