Class: Fastlane::Actions::SetupCiAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
100
101
102
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 100
def self.authors
["mollyIV"]
end
|
.available_options ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 81
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :force,
env_name: "FL_SETUP_CI_FORCE",
description: "Force setup, even if not executed by CI",
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :provider,
env_name: "FL_SETUP_CI_PROVIDER",
description: "CI provider",
is_string: true,
default_value: false,
verify_block: proc do |value|
value = value.to_s
UI.user_error!("A given CI provider '#{value}' is not supported. Available CI providers: 'travis', 'circleci'") unless ["travis", "circleci"].include?(value)
end)
]
end
|
.category ⇒ Object
116
117
118
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 116
def self.category
:misc
end
|
.description ⇒ Object
64
65
66
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 64
def self.description
"Setup the keychain and match to work with CI"
end
|
.details ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 68
def self.details
list = <<-LIST.markdown_list(true)
Creates a new temporary keychain for use with match
Switches match to `readonly` mode to not create new profiles/cert on CI
Sets up log and test result paths to be easily collectible
LIST
[
list,
"This action helps with CI integration. Add this to the top of your Fastfile if you use CI."
].join("\n")
end
|
.example_code ⇒ Object
108
109
110
111
112
113
114
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 108
def self.example_code
[
'setup_ci(
provider: "travis"
)'
]
end
|
.is_supported?(platform) ⇒ Boolean
104
105
106
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 104
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
|
.run(params) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 4
def self.run(params)
unless should_run?(params)
UI.message("Not running on CI, skipping CI setup")
return
end
case params[:provider]
when 'travis'
setup_keychain
when 'circleci'
setup_keychain
setup_output_paths
end
end
|
.setup_keychain ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 23
def self.setup_keychain
unless ENV["MATCH_KEYCHAIN_NAME"].nil?
UI.message("Skipping Keychain setup as a keychain was already specified")
return
end
keychain_name = "fastlane_tmp_keychain"
ENV["MATCH_KEYCHAIN_NAME"] = keychain_name
ENV["MATCH_KEYCHAIN_PASSWORD"] = ""
UI.message("Creating temporary keychain: \"#{keychain_name}\".")
Actions::CreateKeychainAction.run(
name: keychain_name,
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: true,
password: ""
)
UI.message("Enabling match readonly mode.")
ENV["MATCH_READONLY"] = true.to_s
end
|
.setup_output_paths ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 47
def self.setup_output_paths
unless ENV["FL_OUTPUT_DIR"]
UI.message("Skipping Log Path setup as FL_OUTPUT_DIR is unset")
return
end
root = Pathname.new(ENV["FL_OUTPUT_DIR"])
ENV["SCAN_OUTPUT_DIRECTORY"] = (root + "scan").to_s
ENV["GYM_OUTPUT_DIRECTORY"] = (root + "gym").to_s
ENV["FL_BUILDLOG_PATH"] = (root + "buildlogs").to_s
ENV["SCAN_INCLUDE_SIMULATOR_LOGS"] = true.to_s
end
|
.should_run?(params) ⇒ Boolean
19
20
21
|
# File 'fastlane/lib/fastlane/actions/setup_ci.rb', line 19
def self.should_run?(params)
Helper.ci? || params[:force]
end
|