fastlane-plugin-stream_actions 0.3.39 → 0.3.41

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a91a3ce766780880671a7536fab4ed531613ab6773f95ccd01d1343eba86bd58
4
- data.tar.gz: af693c039532c317f4fc0873f8f3d8ef97006c81015cde9e8652fdbd4915fd65
3
+ metadata.gz: b994198c15b60fa994aaa977bf3583961075f4ac62f2f9457a97fad4c8835a5e
4
+ data.tar.gz: 116aa007b31d1dbb3faa57c9da4b7a5232ea70d429a91023f345c70ad2bb1336
5
5
  SHA512:
6
- metadata.gz: 0f0dda72c27a96b6ea570842a4ac8588f617bd1033faf17001764d108ea283c6bf03c5daa2dd69523256171386be71a07a629aeb117edc3ed95873c9e7649339
7
- data.tar.gz: ba13abd574c88c387e7074a5bce17b84bfd377d3825949c3f9b71f2d716a35b988c5a9f8a63f3c710e2a0d7de968355698fd97f3724f23560fed56b938735e58
6
+ metadata.gz: 645f2d5d8342bbd20a7fb0a0f322123abc6b847d9673ad13f783cf5bdd7338ba9f44bc62f2018dc7f1a2566134e63115750d0c81a346cb9cca2a6dfd084fd6ae
7
+ data.tar.gz: 2a2a70ab759cdf167ad9b5e821ff2ab440a8eb8ca7ffe14a4d55d50cae4dc21b288d5e482086b344d86c8c0d0c1922e86b6534a6c6f2c2f20a9eb12e64620850
@@ -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,63 @@
1
+ module Fastlane
2
+ module Actions
3
+ class PrCommentAction < Action
4
+ def self.run(params)
5
+ if params[:pr_num]
6
+ additional_args = []
7
+ if params[:edit_last_comment_with_text]
8
+ UI.message('Checking last comment for required pattern.')
9
+ last_comment = sh("gh pr view #{params[:pr_num]} --json comments --jq '.comments | map(select(.author.login == \"Stream-SDK-Bot\")) | last'")
10
+ last_comment_match = params[:edit_last_comment_with_text] && last_comment.include?(params[:edit_last_comment_with_text])
11
+
12
+ if last_comment_match
13
+ additional_args << '--edit-last'
14
+ else
15
+ UI.important('Last comment does not match the pattern.')
16
+ end
17
+ end
18
+ sh("gh pr comment #{params[:pr_num]} -b '#{params[:text]}' #{additional_args.join(' ')}")
19
+ UI.success('PR comment been added.')
20
+ else
21
+ UI.error('Skipping the PR comment because PR number has not been provided.')
22
+ end
23
+ end
24
+
25
+ #####################################################
26
+ # @!group Documentation
27
+ #####################################################
28
+
29
+ def self.description
30
+ 'Comment in the PR'
31
+ end
32
+
33
+ def self.available_options
34
+ [
35
+ FastlaneCore::ConfigItem.new(
36
+ env_name: 'GITHUB_PR_NUM',
37
+ key: :pr_num,
38
+ description: 'GitHub PR number',
39
+ optional: true
40
+ ),
41
+ FastlaneCore::ConfigItem.new(
42
+ key: :text,
43
+ description: 'Comment text',
44
+ is_string: true,
45
+ verify_block: proc do |text|
46
+ UI.user_error!("Text should not be empty") if text.to_s.empty?
47
+ end
48
+ ),
49
+ FastlaneCore::ConfigItem.new(
50
+ key: :edit_last_comment_with_text,
51
+ description: 'If last comment contains this text it will be edited',
52
+ is_string: true,
53
+ optional: true
54
+ )
55
+ ]
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ true
60
+ end
61
+ end
62
+ end
63
+ 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
 
@@ -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
- 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',
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.3.39'
3
+ VERSION = '0.3.41'
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.39
4
+ version: 0.3.41
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-08 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