fastlane-plugin-stream_actions 0.3.38 → 0.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/stream_actions/actions/allure_api.rb +1 -1
  3. data/lib/fastlane/plugin/stream_actions/actions/allure_create_launch.rb +1 -1
  4. data/lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb +1 -1
  5. data/lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb +1 -1
  6. data/lib/fastlane/plugin/stream_actions/actions/current_branch.rb +38 -0
  7. data/lib/fastlane/plugin/stream_actions/actions/custom_match.rb +1 -1
  8. data/lib/fastlane/plugin/stream_actions/actions/is_check_required.rb +1 -1
  9. data/lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb +1 -1
  10. data/lib/fastlane/plugin/stream_actions/actions/pr_comment.rb +52 -0
  11. data/lib/fastlane/plugin/stream_actions/actions/prepare_simulator.rb +1 -1
  12. data/lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb +2 -2
  13. data/lib/fastlane/plugin/stream_actions/actions/read_changelog.rb +1 -1
  14. data/lib/fastlane/plugin/stream_actions/actions/release_ios_sdk.rb +1 -3
  15. data/lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb +1 -1
  16. data/lib/fastlane/plugin/stream_actions/actions/setup_git_config.rb +32 -0
  17. data/lib/fastlane/plugin/stream_actions/actions/show_frameworks_size.rb +109 -0
  18. data/lib/fastlane/plugin/stream_actions/actions/testflight_build.rb +2 -3
  19. data/lib/fastlane/plugin/stream_actions/actions/update_copyright.rb +1 -1
  20. data/lib/fastlane/plugin/stream_actions/actions/update_testplan.rb +1 -1
  21. data/lib/fastlane/plugin/stream_actions/actions/wait_android_emu_idle.rb +1 -1
  22. data/lib/fastlane/plugin/stream_actions/version.rb +1 -1
  23. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65494bf029fca8b9b830cad525272a61e8abe9d49543135975e0b3d6e1d2a3ed
4
- data.tar.gz: 6bb78c0fd7c2880f595388d31a019af53885f52d29bc54f47f5b40ac4ec63393
3
+ metadata.gz: 9d07284bafaf1a903c4ec18f02f3236b9618a11175e0e80014b5a2b208e6adee
4
+ data.tar.gz: 25157db9413e49166e0200ca96f685f5e88c8667a35b54105f61797a0d78aea9
5
5
  SHA512:
6
- metadata.gz: 07e9cb401e4cea38dba27c06677b637b3843976f967c2feb196c1c7be84eb05d34a8de0e2c7bd2d0ee366766a5a338321497963dc2a4dcfd92c7c88caa405deb
7
- data.tar.gz: eca05076e0bac6623115313fa923606a633e6bcb3aed3bec4378366e3898d65a6a8a81a3ff76b6d74e1714a04a01d6cef7e5cd81be805397f8ea731693ee11d8
6
+ metadata.gz: c6743a7959c88d2557bfd4150828bced03de863a75777cbc2ac905adee2b5bd2932a9754440014bdbf5573d18669c06a571ed0515e934c9a7a2d016a471f715c
7
+ data.tar.gz: bf7f59c648b09424cf150e11e63b7b5a88a7aa5274f3785c2837e54e3d791d20ceb986efa0ca1a177a576d4ba6fb7748276600b6cd80d343f4babaa1c21ee05e
@@ -66,7 +66,7 @@ module Fastlane
66
66
  ]
67
67
  end
68
68
 
69
- def self.supported?(_platform)
69
+ def self.is_supported?(platform)
70
70
  true
71
71
  end
72
72
  end
@@ -89,7 +89,7 @@ module Fastlane
89
89
  ]
90
90
  end
91
91
 
92
- def self.supported?(_platform)
92
+ def self.is_supported?(platform)
93
93
  true
94
94
  end
95
95
  end
@@ -42,7 +42,7 @@ module Fastlane
42
42
  ]
43
43
  end
44
44
 
45
- def self.supported?(_platform)
45
+ def self.is_supported?(platform)
46
46
  true
47
47
  end
48
48
  end
@@ -74,7 +74,7 @@ module Fastlane
74
74
  ]
75
75
  end
76
76
 
77
- def self.supported?(_platform)
77
+ def self.is_supported?(platform)
78
78
  true
79
79
  end
80
80
  end
@@ -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
@@ -61,7 +61,7 @@ module Fastlane
61
61
  ]
62
62
  end
63
63
 
64
- def self.supported?(_platform)
64
+ def self.is_supported?(platform)
65
65
  [:ios].include?(platform)
66
66
  end
67
67
  end
@@ -50,7 +50,7 @@ module Fastlane
50
50
  ]
51
51
  end
52
52
 
53
- def self.supported?(_platform)
53
+ def self.is_supported?(platform)
54
54
  true
55
55
  end
56
56
  end
@@ -42,7 +42,7 @@ module Fastlane
42
42
  ]
43
43
  end
44
44
 
45
- def self.supported?(_platform)
45
+ def self.is_supported?(platform)
46
46
  [:ios].include?(platform)
47
47
  end
48
48
  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
@@ -54,7 +54,7 @@ module Fastlane
54
54
  ]
55
55
  end
56
56
 
57
- def self.supported?(_platform)
57
+ def self.is_supported?(platform)
58
58
  true
59
59
  end
60
60
  end
@@ -15,7 +15,7 @@ module Fastlane
15
15
  name: version_number,
16
16
  tag_name: version_number,
17
17
  description: changes,
18
- commitish: ENV['BRANCH_NAME'] || other_action.git_branch,
18
+ commitish: other_action.current_branch,
19
19
  upload_assets: params[:upload_assets]
20
20
  )
21
21
 
@@ -122,7 +122,7 @@ module Fastlane
122
122
  ]
123
123
  end
124
124
 
125
- def self.supported?(_platform)
125
+ def self.is_supported?(platform)
126
126
  [:ios].include?(platform)
127
127
  end
128
128
  end
@@ -50,7 +50,7 @@ module Fastlane
50
50
  ]
51
51
  end
52
52
 
53
- def self.supported?(_platform)
53
+ def self.is_supported?(platform)
54
54
  true
55
55
  end
56
56
  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)
@@ -148,7 +146,7 @@ module Fastlane
148
146
  ]
149
147
  end
150
148
 
151
- def self.supported?(_platform)
149
+ def self.is_supported?(platform)
152
150
  [:ios].include?(platform)
153
151
  end
154
152
  end
@@ -110,7 +110,7 @@ module Fastlane
110
110
  ]
111
111
  end
112
112
 
113
- def self.supported?(_platform)
113
+ def self.is_supported?(platform)
114
114
  [:ios].include?(platform)
115
115
  end
116
116
  end
@@ -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
- current_branch = ENV['BRANCH_NAME'] || other_action.git_branch
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',
@@ -156,7 +155,7 @@ module Fastlane
156
155
  ]
157
156
  end
158
157
 
159
- def self.supported?(_platform)
158
+ def self.is_supported?(platform)
160
159
  true
161
160
  end
162
161
  end
@@ -47,7 +47,7 @@ module Fastlane
47
47
  ]
48
48
  end
49
49
 
50
- def self.supported?(_platform)
50
+ def self.is_supported?(platform)
51
51
  [:ios].include?(platform)
52
52
  end
53
53
  end
@@ -45,7 +45,7 @@ module Fastlane
45
45
  ]
46
46
  end
47
47
 
48
- def self.supported?(_platform)
48
+ def self.is_supported?(platform)
49
49
  [:ios].include?(platform)
50
50
  end
51
51
  end
@@ -54,7 +54,7 @@ module Fastlane
54
54
  ]
55
55
  end
56
56
 
57
- def self.supported?(_platform)
57
+ def self.is_supported?(platform)
58
58
  [:android].include?(platform)
59
59
  end
60
60
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.3.38'
3
+ VERSION = '0.3.40'
4
4
  end
5
5
  end
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.38
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-06-18 00:00:00.000000000 Z
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