fastlane-plugin-stream_actions 0.3.41 → 0.3.43

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: b994198c15b60fa994aaa977bf3583961075f4ac62f2f9457a97fad4c8835a5e
4
- data.tar.gz: 116aa007b31d1dbb3faa57c9da4b7a5232ea70d429a91023f345c70ad2bb1336
3
+ metadata.gz: 2c2d6f09374fa39e0829509406f8dda6c9ed0e036fb01dba0a353cd78829c721
4
+ data.tar.gz: 269a574b41262d9c91fdefd499c95752a8b02bc713d4a12b79f9e05dfbba5bdd
5
5
  SHA512:
6
- metadata.gz: 645f2d5d8342bbd20a7fb0a0f322123abc6b847d9673ad13f783cf5bdd7338ba9f44bc62f2018dc7f1a2566134e63115750d0c81a346cb9cca2a6dfd084fd6ae
7
- data.tar.gz: 2a2a70ab759cdf167ad9b5e821ff2ab440a8eb8ca7ffe14a4d55d50cae4dc21b288d5e482086b344d86c8c0d0c1922e86b6534a6c6f2c2f20a9eb12e64620850
6
+ metadata.gz: 6ad5c9b54c1e1f6c1b8b97408a01749cc5285c896a6ad4e6dcf7ae5633c0e3f6d34f7be2c289ed402fe3f00f9989799b872c3a72ce2be35fbadedd116a7a1941
7
+ data.tar.gz: 4c49626b2bd0f897d49a877cb1ede5887cc71c60bc8179b57c4a1340b11a29bb7e303d218aebf477c29029da905e9fc26c7f6b3673727aa03d9180ecd2afd030
@@ -0,0 +1,55 @@
1
+ module Fastlane
2
+ module Actions
3
+ class GitStatusAction < Action
4
+ def self.run(params)
5
+ UI.user_error!('Extension should be provided') unless params[:ext]
6
+
7
+ untracked_files = sh('git status -s', log: false).split("\n").map(&:strip)
8
+ UI.important("Git Status: #{untracked_files}")
9
+
10
+ deleted_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'D')
11
+ added_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: ['A', '??'])
12
+ renamed_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'R')
13
+ modified_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'M')
14
+
15
+ renamed_files.each do |renamed_file|
16
+ content = renamed_file.split.drop(1).join.split('->').map(&:strip)
17
+ deleted_files << content.first
18
+ added_files << content.last
19
+ end
20
+ { a: added_files, d: deleted_files, m: modified_files }
21
+ end
22
+
23
+ def select_files_from(files:, with_extension:, that_start_with:)
24
+ files.select do |f|
25
+ f.start_with?(*that_start_with)
26
+ end.map do |f|
27
+ f.split.drop(1).join(' ')
28
+ end.select do |f|
29
+ f.gsub(/['"]/, '').end_with?(with_extension)
30
+ end
31
+ end
32
+
33
+ #####################################################
34
+ # @!group Documentation
35
+ #####################################################
36
+
37
+ def self.description
38
+ 'Git status'
39
+ end
40
+
41
+ def self.available_options
42
+ [
43
+ FastlaneCore::ConfigItem.new(
44
+ key: :ext,
45
+ description: 'Extension'
46
+ )
47
+ ]
48
+ end
49
+
50
+ def self.is_supported?(platform)
51
+ true
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,44 @@
1
+ module Fastlane
2
+ module Actions
3
+ class InstallIosRuntimeAction < Action
4
+ def self.run(params)
5
+ runtimes = `xcrun simctl runtime list -j`
6
+ UI.message("👉 Runtime list:\n#{runtimes}")
7
+ simulators = JSON.parse(runtimes).select do |_, sim|
8
+ sim['platformIdentifier'].end_with?('iphonesimulator') && sim['version'] == params[:version] && sim['state'] == 'Ready'
9
+ end
10
+
11
+ if simulators.empty?
12
+ Dir.chdir('..') do
13
+ sh("echo 'iOS #{params[:version]} Simulator' | ipsw download xcode --sim") if Dir['*.dmg'].first.nil?
14
+ sh("./Scripts/install_ios_runtime.sh #{Dir['*.dmg'].first}")
15
+ UI.success("iOS #{params[:version]} Runtime successfuly installed")
16
+ end
17
+ else
18
+ UI.important("iOS #{params[:version]} Runtime already exists")
19
+ end
20
+ end
21
+
22
+ #####################################################
23
+ # @!group Documentation
24
+ #####################################################
25
+
26
+ def self.description
27
+ 'Install iOS Runtime'
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(
33
+ key: :version,
34
+ description: 'iOS Version'
35
+ )
36
+ ]
37
+ end
38
+
39
+ def self.is_supported?(platform)
40
+ [:ios].include?(platform)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,65 @@
1
+ module Fastlane
2
+ module Actions
3
+ class PrCreateAction < Action
4
+ def self.run(params)
5
+ params[:base_branch] ||= 'develop'
6
+ sh("git checkout -b #{params[:head_branch]}")
7
+ sh('git restore Brewfile.lock.json || true')
8
+ sh('git add -A')
9
+ sh("git commit -m '#{params[:title]}'")
10
+ other_action.push_to_git_remote(tags: false)
11
+
12
+ other_action.create_pull_request(
13
+ api_token: ENV.fetch('GITHUB_TOKEN'),
14
+ repo: params[:github_repo],
15
+ title: params[:title],
16
+ head: params[:head_branch],
17
+ base: params[:base_branch],
18
+ body: 'This PR was created automatically by CI.'
19
+ )
20
+ end
21
+
22
+ #####################################################
23
+ # @!group Documentation
24
+ #####################################################
25
+
26
+ def self.description
27
+ 'Create PR'
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(
33
+ env_name: 'GITHUB_REPOSITORY',
34
+ key: :github_repo,
35
+ description: 'GitHub repo name',
36
+ verify_block: proc do |name|
37
+ UI.user_error!("GITHUB_REPOSITORY should not be empty") if name.to_s.empty?
38
+ end
39
+ ),
40
+ FastlaneCore::ConfigItem.new(
41
+ key: :base_branch,
42
+ description: 'Base branch',
43
+ is_string: true
44
+ ),
45
+ FastlaneCore::ConfigItem.new(
46
+ key: :head_branch,
47
+ description: 'Head branch',
48
+ is_string: true,
49
+ optional: false
50
+ ),
51
+ FastlaneCore::ConfigItem.new(
52
+ key: :title,
53
+ description: 'Title',
54
+ is_string: true,
55
+ optional: false
56
+ )
57
+ ]
58
+ end
59
+
60
+ def self.is_supported?(platform)
61
+ true
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,6 +1,6 @@
1
1
  module Fastlane
2
2
  module Actions
3
- class ShowFrameworksSizeAction < Action
3
+ class ShowSdkSizeAction < Action
4
4
  def self.run(params)
5
5
  warning_status = '🟡' # Warning if a branch is #{max_tolerance} less performant than the benchmark
6
6
  fail_status = '🔴' # Failure if a branch is more than #{max_tolerance} less performant than the benchmark
@@ -18,13 +18,14 @@ module Fastlane
18
18
 
19
19
  table_header = '## SDK Size'
20
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
21
+ params[:branch_sizes].each do |sdk_name, branch_value_kb|
22
+ branch_value_mb = (branch_value_kb / 1024).round(2)
23
+ benchmark_value_kb = benchmark_sizes[sdk_name]
24
+ benchmark_value_mb = (benchmark_value_kb / 1024).round(2)
25
+ max_tolerance = 500 # Max Tolerance is 500KB
26
+ fine_tolerance = 250 # Fine Tolerance is 250KB
26
27
 
27
- diff = (branch_value - benchmark_value).round(2)
28
+ diff = branch_value_kb - benchmark_value_kb
28
29
 
29
30
  status_emoji =
30
31
  if diff < 0
@@ -37,7 +38,7 @@ module Fastlane
37
38
  success_status
38
39
  end
39
40
 
40
- markdown_table << "|#{title}|#{benchmark_value}MB|#{branch_value}MB|#{diff}MB|#{status_emoji}|\n"
41
+ markdown_table << "|#{sdk_name}|#{benchmark_value_mb}MB|#{branch_value_mb}MB|#{diff.round(2)}KB|#{status_emoji}|\n"
41
42
  end
42
43
 
43
44
  FastlaneCore::PrintTable.print_values(title: 'Benchmark', config: benchmark_sizes)
@@ -69,7 +70,7 @@ module Fastlane
69
70
  #####################################################
70
71
 
71
72
  def self.description
72
- 'Show frameworks size'
73
+ 'Show SDKs size'
73
74
  end
74
75
 
75
76
  def self.available_options
@@ -82,14 +83,6 @@ module Fastlane
82
83
  UI.user_error!("GITHUB_REPOSITORY should not be empty") if name.to_s.empty?
83
84
  end
84
85
  ),
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
86
  FastlaneCore::ConfigItem.new(
94
87
  key: :branch_sizes,
95
88
  description: 'Branch sizes',
@@ -0,0 +1,47 @@
1
+ module Fastlane
2
+ module Actions
3
+ class UpdateSdkSizeInReadmeAction < Action
4
+ def self.run(params)
5
+ readme_content = File.read(params[:readme_path])
6
+
7
+ params[:sizes].each do |key, value|
8
+ framework_size_kb = value
9
+ framework_size_mb = (framework_size_kb / 1024).round(2)
10
+ readme_content.gsub!(%r{(https://img.shields.io/badge/#{key}-)(.*?)(-blue)}, "\\1#{framework_size_mb}\\3")
11
+ end
12
+
13
+ File.write(params[:readme_path], readme_content)
14
+ UI.success('Successfully updated the SDK size labels in README.md!')
15
+ end
16
+
17
+ #####################################################
18
+ # @!group Documentation
19
+ #####################################################
20
+
21
+ def self.description
22
+ 'Update SDKs size in README.md'
23
+ end
24
+
25
+ def self.available_options
26
+ [
27
+ FastlaneCore::ConfigItem.new(
28
+ key: :readme_path,
29
+ description: 'Path to README.md',
30
+ verify_block: proc do |name|
31
+ UI.user_error!("Path to README.md should not be empty") if name.to_s.empty?
32
+ end
33
+ ),
34
+ FastlaneCore::ConfigItem.new(
35
+ key: :sizes,
36
+ description: 'SDK sizes',
37
+ is_string: false
38
+ )
39
+ ]
40
+ end
41
+
42
+ def self.is_supported?(platform)
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.3.41'
3
+ VERSION = '0.3.43'
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.41
4
+ version: 0.3.43
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-09 00:00:00.000000000 Z
11
+ date: 2024-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list
@@ -235,19 +235,23 @@ files:
235
235
  - lib/fastlane/plugin/stream_actions/actions/build_app_for_ios_simulator.rb
236
236
  - lib/fastlane/plugin/stream_actions/actions/current_branch.rb
237
237
  - lib/fastlane/plugin/stream_actions/actions/custom_match.rb
238
+ - lib/fastlane/plugin/stream_actions/actions/git_status.rb
239
+ - lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb
238
240
  - lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
239
241
  - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
240
242
  - lib/fastlane/plugin/stream_actions/actions/pr_comment.rb
243
+ - lib/fastlane/plugin/stream_actions/actions/pr_create.rb
241
244
  - lib/fastlane/plugin/stream_actions/actions/prepare_simulator.rb
242
245
  - lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb
243
246
  - lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
244
247
  - lib/fastlane/plugin/stream_actions/actions/release_ios_sdk.rb
245
248
  - lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb
246
249
  - lib/fastlane/plugin/stream_actions/actions/setup_git_config.rb
247
- - lib/fastlane/plugin/stream_actions/actions/show_frameworks_size.rb
250
+ - lib/fastlane/plugin/stream_actions/actions/show_sdk_size.rb
248
251
  - lib/fastlane/plugin/stream_actions/actions/testflight_build.rb
249
252
  - lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb
250
253
  - lib/fastlane/plugin/stream_actions/actions/update_copyright.rb
254
+ - lib/fastlane/plugin/stream_actions/actions/update_sdk_size_in_readme.rb
251
255
  - lib/fastlane/plugin/stream_actions/actions/update_testplan.rb
252
256
  - lib/fastlane/plugin/stream_actions/actions/wait_android_emu_idle.rb
253
257
  - lib/fastlane/plugin/stream_actions/version.rb