Class: Fastlane::Actions::BluepillarAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb

Constant Summary collapse

BLUEPILL_PATH =
'/usr/local/bin/bluepill'
BP_PATH =
'/usr/local/bin/bp'

Class Method Summary collapse

Class Method Details

.authorsObject



51
52
53
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 51

def self.authors
  ["Shashikant86"]
end

.available_optionsObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 63

def self.available_options
  [
     FastlaneCore::ConfigItem.new(key: :app,
                                 env_name: "BLUEPILLAR_APP_PATH",
                                 description: "Path to the main app to be build for the bluepill in the Derived Data",
                                 is_string: true,
                                 optional: false),

     FastlaneCore::ConfigItem.new(key: :runner_app_path,
                                env_name: "BLUEPILLAR_RUNNER_APP_PATH",
                                description: "Path to the test runner app in the Derived Data",
                                is_string: true,
                                optional: true),

     FastlaneCore::ConfigItem.new(key: :scheme_path,
                               env_name: "BLUEPILLAR_XCTEST_SCHEME_PATH",
                               description: "Path to the scheme to be build for the bluepill in the .xcodeproj",
                               is_string: true,
                               optional: false),

     FastlaneCore::ConfigItem.new(key: :output_dir,
                              env_name: "BLUEPILLAR_REPORT_PATH",
                              description: "Path to store simulator logs and test reports",
                              is_string: true,
                              optional: false),

     FastlaneCore::ConfigItem.new(key: :num_sims,
                              env_name: "BLUEPILLAR_SUMULATORS",
                              description: "Number of sumulators to be launched",
                              default_value: "3",
                              is_string: true,
                              optional: true),

     FastlaneCore::ConfigItem.new(key: :runtime,
                             env_name: "BLUEPILLAR_IOS_VERSION",
                             description: "The iOS version to be used for testing",
                             default_value: '"iOS 10.3"',
                             is_string: true,
                             optional: true),

     FastlaneCore::ConfigItem.new(key: :device,
                             env_name: "BLUEPILLAR_IOS_DEVICE",
                             description: "The iOS device to be used for testing",
                             default_value: "'iPhone 6'",
                             is_string: true,
                             optional: true),
  ]
end

.descriptionObject



47
48
49
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 47

def self.description
  "Run XCUITests in Parallel using Bluepill"
end

.detailsObject



59
60
61
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 59

def self.details
  "This plugin will allow you to run XCUITests in Parallel using LinkedIn's Bluepil"
end

.example_codeObject



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 112

def self.example_code
       ['   bluepillar(
                app: "bluepill/Build/Products/Debug-iphonesimulator/Bluepillar.app",
                runner_app_path: "bluepill/Build/Products/Debug-iphonesimulator/BluepillarUITests-Runner.app",
                scheme_path: "Bluepillar.xcodeproj/xcshareddata/xcschemes/Bluepillar.xcscheme",
                output_dir: "bluepill_output/",
                num_sims: "3",
                runtime: '"iOS 10.3"',
            )
      ']
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


124
125
126
127
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 124

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
  true
end

.return_valueObject



55
56
57
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 55

def self.return_value

end

.run(params) ⇒ Object



6
7
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
# File 'lib/fastlane/plugin/bluepillar/actions/bluepillar_action.rb', line 6

def self.run(params)
  UI.message("Starting XCTests using the bluepillar fastlane plugin!")
  unless File.exist?(BLUEPILL_PATH)
    UI.user_error!("You must download bluepill binary from Github and put it in /usr/local/bin/bluepill to carry on execution")
  end

  unless File.exist?(BP_PATH)
    UI.user_error!("You must download bp binary from Github and put it in /usr/local/bin/bp to carry on execution")
  end

  bluepill_app_path = params[:app]
  bluepill_runner_app_path = params[:runner_app_path]
  bluepill_scheme_path = params[:scheme_path]
  bluepill_num_sims = params[:num_sims]
  bluepill_output_dir = params[:output_dir]
  bluepill_runtime = params[:runtime]
  bluepill_device = params[:device]
  processed_device = bluepill_device.gsub(/ /, '\ ')


  command = [
    'bluepill',
    '-a',
    bluepill_app_path,
    '-s',
    bluepill_scheme_path,
    '-o',
    bluepill_output_dir,
    '-r',
    bluepill_runtime,
    '-n',
    bluepill_num_sims,
    '-d',
    processed_device,
  ]

  command.concat ['-u', bluepill_runner_app_path] if bluepill_runner_app_path

  Actions.sh(command.join(' '))
end