Class: Fastlane::Actions::TestfairyAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::TestfairyAction
- Defined in:
- lib/fastlane/actions/testfairy.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
201 202 203 |
# File 'lib/fastlane/actions/testfairy.rb', line 201 def self. ["taka0125", "tcurdt"] end |
.available_options ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/fastlane/actions/testfairy.rb', line 109 def self. [ # required FastlaneCore::ConfigItem.new(key: :api_key, env_name: "FL_TESTFAIRY_API_KEY", # The name of the environment variable description: "API Key for TestFairy", # a short description of this parameter verify_block: proc do |value| UI.user_error!("No API key for TestFairy given, pass using `api_key: 'key'`") unless value.to_s.length > 0 end), FastlaneCore::ConfigItem.new(key: :ipa, env_name: 'TESTFAIRY_IPA_PATH', description: 'Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action', default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH], verify_block: proc do |value| UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value) end), # optional FastlaneCore::ConfigItem.new(key: :symbols_file, optional: true, env_name: "FL_TESTFAIRY_SYMBOLS_FILE", description: "Symbols mapping file", default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH], verify_block: proc do |value| UI.user_error!("Couldn't find dSYM file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :testers_groups, optional: true, type: Array, short_option: '-g', env_name: "FL_TESTFAIRY_TESTERS_GROUPS", description: "Array of tester groups to be notified", default_value: []), # the default value is an empty list FastlaneCore::ConfigItem.new(key: :metrics, optional: true, type: Array, env_name: "FL_TESTFAIRY_METRICS", description: "Array of metrics to record (cpu,memory,network,phone_signal,gps,battery,mic,wifi)", default_value: []), # max-duration # video # video-quality # video-rate FastlaneCore::ConfigItem.new(key: :icon_watermark, optional: true, env_name: "FL_TESTFAIRY_ICON_WATERMARK", description: "Add a small watermark to app icon", default_value: 'off'), FastlaneCore::ConfigItem.new(key: :comment, optional: true, env_name: "FL_TESTFAIRY_COMMENT", description: "Additional release notes for this upload. This text will be added to email notifications", default_value: 'No comment provided'), # the default value if the user didn't provide one FastlaneCore::ConfigItem.new(key: :auto_update, optional: true, env_name: "FL_TESTFAIRY_AUTO_UPDATE", description: "Allows easy upgrade of all users to current version", default_value: 'off'), # not well documented FastlaneCore::ConfigItem.new(key: :notify, optional: true, env_name: "FL_TESTFAIRY_NOTIFY", description: "Send email to testers", default_value: 'off'), FastlaneCore::ConfigItem.new(key: :options, optional: true, type: Array, env_name: "FL_TESTFAIRY_OPTIONS", description: "Array of options (shake,video_only_wifi,anonymous)", default_value: []) ] end |
.category ⇒ Object
191 192 193 |
# File 'lib/fastlane/actions/testfairy.rb', line 191 def self.category :beta end |
.description ⇒ Object
101 102 103 |
# File 'lib/fastlane/actions/testfairy.rb', line 101 def self.description 'Upload a new build to TestFairy' end |
.details ⇒ Object
105 106 107 |
# File 'lib/fastlane/actions/testfairy.rb', line 105 def self.details "You can retrieve your API key on [your settings page](https://free.testfairy.com/settings/)" end |
.example_code ⇒ Object
181 182 183 184 185 186 187 188 189 |
# File 'lib/fastlane/actions/testfairy.rb', line 181 def self.example_code [ 'testfairy( api_key: "...", ipa: "./ipa_file.ipa", comment: "Build #{lane_context[SharedValues::BUILD_NUMBER]}", )' ] end |
.is_supported?(platform) ⇒ Boolean
205 206 207 |
# File 'lib/fastlane/actions/testfairy.rb', line 205 def self.is_supported?(platform) platform == :ios end |
.output ⇒ Object
195 196 197 198 199 |
# File 'lib/fastlane/actions/testfairy.rb', line 195 def self.output [ ['TESTFAIRY_BUILD_URL', 'URL of the newly uploaded build'] ] end |
.run(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fastlane/actions/testfairy.rb', line 8 def self.run(params) require 'shenzhen' require 'shenzhen/plugins/testfairy' UI.success('Starting with ipa upload to TestFairy...') client = Shenzhen::Plugins::TestFairy::Client.new( params[:api_key] ) return params[:ipa] if Helper.test? metrics_to_client = lambda do |metrics| metrics.map do |metric| case metric when :cpu, :memory, :network, :gps, :battery, :mic, :wifi metric.to_s when :phone_signal 'phone-signal' else UI.user_error!("Unknown metric: #{metric}") end end end = lambda do || .map do |option| case option when :shake, :anonymous option.to_s when :video_only_wifi 'video-only-wifi' else UI.user_error!("Unknown option: #{option}") end end end = Hash[params.values.map do |key, value| case key when :api_key [key, value] when :ipa [key, value] when :symbols_file [key, value] when :testers_groups [key, value.join(',')] when :metrics [key, metrics_to_client.call(value).join(',')] when :icon_watermark ['icon-watermark', value] when :comment [key, value] when :auto_update ['auto-update', value] when :notify [key, value] when :options [key, .call(value).join(',')] else UI.user_error!("Unknown parameter: #{key}") end end] response = client.upload_build(params[:ipa], ) if parse_response(response) UI.success("Build URL: #{Actions.lane_context[SharedValues::TESTFAIRY_BUILD_URL]}") UI.success("Build successfully uploaded to TestFairy.") else UI.user_error!("Error when trying to upload ipa to TestFairy") end end |