fastlane-plugin-stream_actions 0.3.39 → 0.3.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/stream_actions/actions/current_branch.rb +38 -0
- data/lib/fastlane/plugin/stream_actions/actions/pr_comment.rb +52 -0
- data/lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb +1 -1
- data/lib/fastlane/plugin/stream_actions/actions/release_ios_sdk.rb +0 -2
- data/lib/fastlane/plugin/stream_actions/actions/setup_git_config.rb +32 -0
- data/lib/fastlane/plugin/stream_actions/actions/show_frameworks_size.rb +109 -0
- data/lib/fastlane/plugin/stream_actions/actions/testflight_build.rb +1 -2
- data/lib/fastlane/plugin/stream_actions/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d07284bafaf1a903c4ec18f02f3236b9618a11175e0e80014b5a2b208e6adee
|
4
|
+
data.tar.gz: 25157db9413e49166e0200ca96f685f5e88c8667a35b54105f61797a0d78aea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6743a7959c88d2557bfd4150828bced03de863a75777cbc2ac905adee2b5bd2932a9754440014bdbf5573d18669c06a571ed0515e934c9a7a2d016a471f715c
|
7
|
+
data.tar.gz: bf7f59c648b09424cf150e11e63b7b5a88a7aa5274f3785c2837e54e3d791d20ceb986efa0ca1a177a576d4ba6fb7748276600b6cd80d343f4babaa1c21ee05e
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class CurrentBranchAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
branch = if params[:pr_num].to_s.empty?
|
6
|
+
other_action.git_branch
|
7
|
+
else
|
8
|
+
sh("gh pr view #{params[:pr_num]} --json headRefName -q .headRefName").strip
|
9
|
+
end
|
10
|
+
|
11
|
+
UI.important("Current branch: #{branch} 🕊️")
|
12
|
+
branch
|
13
|
+
end
|
14
|
+
|
15
|
+
#####################################################
|
16
|
+
# @!group Documentation
|
17
|
+
#####################################################
|
18
|
+
|
19
|
+
def self.description
|
20
|
+
'Get current branch name'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.available_options
|
24
|
+
[
|
25
|
+
FastlaneCore::ConfigItem.new(
|
26
|
+
env_name: 'GITHUB_PR_NUM',
|
27
|
+
key: :pr_num,
|
28
|
+
description: 'GitHub PR number'
|
29
|
+
)
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.is_supported?(platform)
|
34
|
+
true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class PrCommentAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
if params[:pr_num]
|
6
|
+
last_comment = sh("gh pr view #{params[:pr_num]} --json comments --jq '.comments | map(select(.author.login == \"Stream-SDK-Bot\")) | last'")
|
7
|
+
edit_last_comment = params[:edit_last_comment_with_text] && last_comment.include?(params[:edit_last_comment_with_text]) ? '--edit-last' : ''
|
8
|
+
sh("gh pr comment #{params[:pr_num]} #{edit_last_comment} -b '#{params[:text]}'")
|
9
|
+
else
|
10
|
+
UI.important('Skipping the PR comment because PR number has not been provided.')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
#####################################################
|
15
|
+
# @!group Documentation
|
16
|
+
#####################################################
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
'Comment in the PR'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.available_options
|
23
|
+
[
|
24
|
+
FastlaneCore::ConfigItem.new(
|
25
|
+
env_name: 'GITHUB_PR_NUM',
|
26
|
+
key: :pr_num,
|
27
|
+
description: 'GitHub PR number',
|
28
|
+
optional: true
|
29
|
+
),
|
30
|
+
FastlaneCore::ConfigItem.new(
|
31
|
+
key: :text,
|
32
|
+
description: 'Comment text',
|
33
|
+
is_string: true,
|
34
|
+
verify_block: proc do |text|
|
35
|
+
UI.user_error!("Text should not be empty") if text.to_s.empty?
|
36
|
+
end
|
37
|
+
),
|
38
|
+
FastlaneCore::ConfigItem.new(
|
39
|
+
key: :edit_last_comment_with_text,
|
40
|
+
description: 'If last comment contains this text it will be edited',
|
41
|
+
is_string: true,
|
42
|
+
optional: true
|
43
|
+
)
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.is_supported?(platform)
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -58,8 +58,6 @@ module Fastlane
|
|
58
58
|
if params[:version].nil? && !["patch", "minor", "major"].include?(params[:bump_type])
|
59
59
|
UI.user_error!("Please use type parameter with one of the options: type:patch, type:minor, type:major")
|
60
60
|
end
|
61
|
-
|
62
|
-
sh('git config --global user.name "Stream Bot"')
|
63
61
|
end
|
64
62
|
|
65
63
|
def self.ensure_release_tag_is_new(version_number)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class SetupGitConfigAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
params[:username] ||= 'Stream Bot'
|
6
|
+
sh("git config --global user.name '#{params[:username]}'")
|
7
|
+
end
|
8
|
+
|
9
|
+
#####################################################
|
10
|
+
# @!group Documentation
|
11
|
+
#####################################################
|
12
|
+
|
13
|
+
def self.description
|
14
|
+
'Update git config details'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.available_options
|
18
|
+
[
|
19
|
+
FastlaneCore::ConfigItem.new(
|
20
|
+
key: :username,
|
21
|
+
description: 'Username',
|
22
|
+
optional: true
|
23
|
+
)
|
24
|
+
]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.is_supported?(platform)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class ShowFrameworksSizeAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
warning_status = '🟡' # Warning if a branch is #{max_tolerance} less performant than the benchmark
|
6
|
+
fail_status = '🔴' # Failure if a branch is more than #{max_tolerance} less performant than the benchmark
|
7
|
+
success_status = '🟢' # Success if a branch is more performant or equals to the benchmark
|
8
|
+
outstanding_status = '🚀' # Outstanding performance
|
9
|
+
|
10
|
+
metrics_dir = 'metrics'
|
11
|
+
FileUtils.remove_dir(metrics_dir, force: true)
|
12
|
+
sdk_size_path = "#{metrics_dir}/#{params[:github_repo].split('/').last}-size.json"
|
13
|
+
sh("git clone git@github.com:GetStream/apple-internal-metrics.git #{metrics_dir}/")
|
14
|
+
is_release = other_action.current_branch.include?('release/')
|
15
|
+
benchmark_config = JSON.parse(File.read(sdk_size_path))
|
16
|
+
benchmark_key = is_release ? 'release' : 'develop'
|
17
|
+
benchmark_sizes = benchmark_config[benchmark_key]
|
18
|
+
|
19
|
+
table_header = '## SDK Size'
|
20
|
+
markdown_table = "#{table_header}\n| `title` | `#{is_release ? 'previous release' : 'develop'}` | `#{is_release ? 'current release' : 'branch'}` | `diff` | `status` |\n| - | - | - | - | - |\n"
|
21
|
+
params[:sdk_names].each do |title|
|
22
|
+
benchmark_value = benchmark_sizes[title]
|
23
|
+
branch_value = params[:branch_sizes][title.to_sym]
|
24
|
+
max_tolerance = 0.5 # Max Tolerance is 0.5MB
|
25
|
+
fine_tolerance = 0.25 # Fine Tolerance is 0.25MB
|
26
|
+
|
27
|
+
diff = (branch_value - benchmark_value).round(2)
|
28
|
+
|
29
|
+
status_emoji =
|
30
|
+
if diff < 0
|
31
|
+
outstanding_status
|
32
|
+
elsif diff >= max_tolerance
|
33
|
+
fail_status
|
34
|
+
elsif diff >= fine_tolerance
|
35
|
+
warning_status
|
36
|
+
else
|
37
|
+
success_status
|
38
|
+
end
|
39
|
+
|
40
|
+
markdown_table << "|#{title}|#{benchmark_value}MB|#{branch_value}MB|#{diff}MB|#{status_emoji}|\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
FastlaneCore::PrintTable.print_values(title: 'Benchmark', config: benchmark_sizes)
|
44
|
+
FastlaneCore::PrintTable.print_values(title: 'SDK Size', config: params[:branch_sizes])
|
45
|
+
|
46
|
+
if other_action.is_ci
|
47
|
+
if is_release || ENV['GITHUB_EVENT_NAME'].to_s == 'push'
|
48
|
+
benchmark_config[benchmark_key] = params[:branch_sizes]
|
49
|
+
File.write(sdk_size_path, JSON.pretty_generate(benchmark_config))
|
50
|
+
Dir.chdir(File.dirname(sdk_size_path)) do
|
51
|
+
if sh('git status -s', log: false).to_s.empty?
|
52
|
+
UI.important('No changes in SDK sizes benchmarks.')
|
53
|
+
else
|
54
|
+
sh('git add -A')
|
55
|
+
sh("git commit -m 'Update #{sdk_size_path}'")
|
56
|
+
sh('git push')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
other_action.pr_comment(text: markdown_table, edit_last_comment_with_text: table_header)
|
62
|
+
end
|
63
|
+
|
64
|
+
UI.user_error!("#{table_header} benchmark failed.") if markdown_table.include?(fail_status)
|
65
|
+
end
|
66
|
+
|
67
|
+
#####################################################
|
68
|
+
# @!group Documentation
|
69
|
+
#####################################################
|
70
|
+
|
71
|
+
def self.description
|
72
|
+
'Show frameworks size'
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.available_options
|
76
|
+
[
|
77
|
+
FastlaneCore::ConfigItem.new(
|
78
|
+
env_name: 'GITHUB_REPOSITORY',
|
79
|
+
key: :github_repo,
|
80
|
+
description: 'GitHub repo name',
|
81
|
+
verify_block: proc do |name|
|
82
|
+
UI.user_error!("GITHUB_REPOSITORY should not be empty") if name.to_s.empty?
|
83
|
+
end
|
84
|
+
),
|
85
|
+
FastlaneCore::ConfigItem.new(
|
86
|
+
key: :sdk_names,
|
87
|
+
description: 'SDK names',
|
88
|
+
is_string: false,
|
89
|
+
verify_block: proc do |sdks|
|
90
|
+
UI.user_error!("SDK names array has to be specified") unless sdks.kind_of?(Array) && sdks.size.positive?
|
91
|
+
end
|
92
|
+
),
|
93
|
+
FastlaneCore::ConfigItem.new(
|
94
|
+
key: :branch_sizes,
|
95
|
+
description: 'Branch sizes',
|
96
|
+
is_string: false,
|
97
|
+
verify_block: proc do |s|
|
98
|
+
UI.user_error!("Branch sizes have to be specified") if s.nil?
|
99
|
+
end
|
100
|
+
)
|
101
|
+
]
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.is_supported?(platform)
|
105
|
+
true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -30,8 +30,7 @@ module Fastlane
|
|
30
30
|
xcargs: params[:xcargs]
|
31
31
|
)
|
32
32
|
|
33
|
-
|
34
|
-
external_groups = current_branch == 'main' ? ['Public Link'] : []
|
33
|
+
external_groups = other_action.current_branch == 'main' ? ['Public Link'] : []
|
35
34
|
other_action.pilot(
|
36
35
|
api_key: params[:api_key],
|
37
36
|
team_id: '118902954',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-stream_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GetStream
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xctest_list
|
@@ -233,14 +233,18 @@ files:
|
|
233
233
|
- lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb
|
234
234
|
- lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb
|
235
235
|
- lib/fastlane/plugin/stream_actions/actions/build_app_for_ios_simulator.rb
|
236
|
+
- lib/fastlane/plugin/stream_actions/actions/current_branch.rb
|
236
237
|
- lib/fastlane/plugin/stream_actions/actions/custom_match.rb
|
237
238
|
- lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
|
238
239
|
- lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
|
240
|
+
- lib/fastlane/plugin/stream_actions/actions/pr_comment.rb
|
239
241
|
- lib/fastlane/plugin/stream_actions/actions/prepare_simulator.rb
|
240
242
|
- lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb
|
241
243
|
- lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
|
242
244
|
- lib/fastlane/plugin/stream_actions/actions/release_ios_sdk.rb
|
243
245
|
- lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb
|
246
|
+
- lib/fastlane/plugin/stream_actions/actions/setup_git_config.rb
|
247
|
+
- lib/fastlane/plugin/stream_actions/actions/show_frameworks_size.rb
|
244
248
|
- lib/fastlane/plugin/stream_actions/actions/testflight_build.rb
|
245
249
|
- lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb
|
246
250
|
- lib/fastlane/plugin/stream_actions/actions/update_copyright.rb
|