fastlane-plugin-stream_actions 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8f544bf6c83e2ee40065898727ea89248813a39d762226da369fed2f2bbc2c17
4
+ data.tar.gz: 2d0af5023635377fbd00563aab6e2a775afcbcb75d8ceae4ceea2c91574b0065
5
+ SHA512:
6
+ metadata.gz: 7c828c0531e835db91bcc70e244564422d94919e3447a14cf9f04cca1512be6b28ce920b9d07c1a36f18bbdce89818e63ea5fb7a21067805e748efc88764b428
7
+ data.tar.gz: 8eb6b7a75fcae621754a4caa7b3f84a4b823ac159b3e3ebf1381372e81760cbf8f47a79b1e625eacae998add77535930a72b3aa0a4c784d36be9928139c7ca8f
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Stream Fastlane Actions
2
+
3
+ ## Getting Started
4
+
5
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-stream_actions`, add it to your project by updating the `Pluginfile`:
6
+
7
+ ```ruby
8
+ gem 'fastlane-plugin-stream_actions'
9
+ ```
10
+
11
+ ## About stream_actions
12
+
13
+ | Action | Description | Supported Platforms |
14
+ | ------ | ----------- | ------------------- |
15
+ | [retrieve_xctest_names](docs/actions/retrieve_xctest_names.md)| Retrieves test names from xctestrun file | ios |
16
+ | [touch_changelog](docs/actions/touch_changelog.md)| Updates `CHANGELOG.md` file with release | |
17
+
18
+ ## Start working on this plugin
19
+
20
+ First of all, install any dependencies
21
+
22
+ ```bash
23
+ bundle install
24
+ ```
25
+
26
+ ## Run tests for this plugin
27
+
28
+ To run both the tests, and code style validation, run
29
+
30
+ ```bash
31
+ bundle exec rake
32
+ ```
33
+
34
+ To automatically fix many of the styling issues, use
35
+
36
+ ```bash
37
+ bundle exec rubocop -a
38
+ ```
39
+
40
+ ## Release a new version
41
+
42
+ To release the plugin, bump the plugin version and run
43
+
44
+ ```bash
45
+ bundle exec fastlane release
46
+ ```
47
+
48
+ ## Issues and Feedback
49
+
50
+ For any other issues and feedback about this plugin, please submit it to this repository.
51
+
52
+ ## Troubleshooting
53
+
54
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
55
+
56
+ ## Using _fastlane_ Plugins
57
+
58
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
59
+
60
+ ## About _fastlane_
61
+
62
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,122 @@
1
+ require 'plist'
2
+ require 'xctest_list'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class RetrieveXCTestNamesAction < Action
7
+ def self.run(params)
8
+ UI.verbose("Getting tests from xctestrun file at '#{params[:xctestrun]}'")
9
+ xctestrun_tests(params[:xctestrun])
10
+ end
11
+
12
+ def self.xctestrun_tests(xctestrun_path)
13
+ xctestrun = Plist.parse_xml(xctestrun_path)
14
+ xctestrun_rootpath = File.dirname(xctestrun_path)
15
+ xctestrun_version = xctestrun.fetch(xctestrun_metadata) { {} }.fetch('FormatVersion') { 1 }
16
+
17
+ test_targets = []
18
+ if xctestrun_version == 1
19
+ xctestrun.each do |testable_name, test_target_config|
20
+ next if testable_name == xctestrun_metadata
21
+
22
+ test_target_config['TestableName'] = testable_name
23
+ test_targets << test_target_config
24
+ end
25
+ else
26
+ test_configurations = xctestrun['TestConfigurations']
27
+ test_configurations.each do |configuration|
28
+ configuration['TestTargets'].each do |test_target|
29
+ test_target['TestableName'] = test_target['BlueprintName']
30
+ test_targets << test_target
31
+ end
32
+ end
33
+ end
34
+
35
+ tests = {}
36
+ test_targets.each do |xctestrun_config|
37
+ testable_name = xctestrun_config['TestableName']
38
+ xctest_path = xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
39
+ test_identifiers = []
40
+ if xctestrun_config.key?('OnlyTestIdentifiers')
41
+ test_identifiers = xctestrun_config['OnlyTestIdentifiers']
42
+ UI.verbose("Identifiers after adding onlytest tests: #{test_identifiers.join("\n\t")}")
43
+ else
44
+ test_identifiers = XCTestList.tests(xctest_path)
45
+ UI.verbose("Found the following tests: #{test_identifiers.join("\n\t")}")
46
+ end
47
+ if xctestrun_config.key?('SkipTestIdentifiers')
48
+ test_identifiers = subtract_skipped_tests_from_test_identifiers(
49
+ test_identifiers,
50
+ xctestrun_config['SkipTestIdentifiers']
51
+ )
52
+ UI.verbose("Identifiers after removing skipped tests: #{test_identifiers.join("\n\t")}")
53
+ end
54
+ if test_identifiers.empty?
55
+ UI.error("No tests found in '#{xctest_path}'!")
56
+ UI.important("Check `ENABLE_TESTABILITY` build setting in `#{testable_name}` test target.")
57
+ end
58
+ tests[testable_name] = test_identifiers.map { |test_identifier| "#{testable_name}/#{test_identifier}" }
59
+ end
60
+ tests
61
+ end
62
+
63
+ def self.subtract_skipped_tests_from_test_identifiers(test_identifiers, skipped_test_identifiers)
64
+ skipped_tests_identifiers = []
65
+ skipped_testsuites = []
66
+ skipped_test_identifiers.each do |skipped_test|
67
+ if skipped_test.split('/').size > 1
68
+ skipped_tests_identifiers << skipped_test
69
+ else
70
+ skipped_testsuites << skipped_test
71
+ end
72
+ end
73
+ skipped_testsuites.each do |skipped_testsuite|
74
+ derived_skipped_tests = test_identifiers.select do |test_identifier|
75
+ test_identifier.start_with?(skipped_testsuite)
76
+ end
77
+ skipped_tests_identifiers.concat(derived_skipped_tests)
78
+ end
79
+
80
+ UI.verbose("Removing skipped tests: #{skipped_tests_identifiers.join("\n\t")}")
81
+ test_identifiers.reject { |test_identifier| skipped_tests_identifiers.include?(test_identifier) }
82
+ end
83
+
84
+ def self.xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
85
+ xctest_host_path = xctestrun_config['TestHostPath'].sub('__TESTROOT__', xctestrun_rootpath)
86
+ xctestrun_config['TestBundlePath'].sub('__TESTHOST__', xctest_host_path).sub('__TESTROOT__', xctestrun_rootpath)
87
+ end
88
+
89
+ def self.xctestrun_metadata
90
+ '__xctestrun_metadata__'
91
+ end
92
+
93
+ #####################################################
94
+ # @!group Documentation
95
+ #####################################################
96
+
97
+ def self.description
98
+ 'Retrieves test names from xctestrun file'
99
+ end
100
+
101
+ def self.available_options
102
+ [
103
+ FastlaneCore::ConfigItem.new(
104
+ key: :xctestrun,
105
+ description: 'The xctestrun file path',
106
+ verify_block: proc do |path|
107
+ UI.user_error!("Cannot find the xctestrun file '#{path}'") unless File.exist?(path)
108
+ end
109
+ )
110
+ ]
111
+ end
112
+
113
+ def self.authors
114
+ ['alteral']
115
+ end
116
+
117
+ def self.supported?(_platform)
118
+ [:ios].include?(platform)
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,85 @@
1
+ module Fastlane
2
+ module Actions
3
+ class TouchChangelogAction < Action
4
+ def self.run(params)
5
+ changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty?
6
+ release_version = params[:release_version] unless params[:release_version].to_s.empty?
7
+
8
+ UI.message("Starting to update '#{changelog_path}'")
9
+
10
+ file_data = File.readlines(changelog_path)
11
+ upcoming_line = -1
12
+ changes_since_last_release = ''
13
+
14
+ File.open(changelog_path).each.with_index do |line, index|
15
+ if upcoming_line != -1
16
+ if line.start_with?('# [')
17
+ break
18
+ else
19
+ changes_since_last_release += line
20
+ end
21
+ elsif line == "# Upcoming\n"
22
+ upcoming_line = index
23
+ end
24
+ end
25
+
26
+ file_data[upcoming_line] = "# [#{release_version}](https://github.com/#{params[:github_repo]}/releases/tag/#{release_version})"
27
+
28
+ today = Time.now.strftime('%B %d, %Y')
29
+ file_data.insert(upcoming_line + 1, "_#{today}_")
30
+ file_data.insert(upcoming_line, '# Upcoming')
31
+ file_data.insert(upcoming_line + 1, '')
32
+ file_data.insert(upcoming_line + 2, '### 🔄 Changed')
33
+ file_data.insert(upcoming_line + 3, '')
34
+
35
+ # Write updated content to file
36
+ changelog = File.open(changelog_path, 'w')
37
+ changelog.puts(file_data)
38
+ changelog.close
39
+ UI.success("Successfully updated #{changelog_path}")
40
+ return changes_since_last_release
41
+ end
42
+
43
+ #####################################################
44
+ # @!group Documentation
45
+ #####################################################
46
+
47
+ def self.description
48
+ 'Updates CHANGELOG.md file with release'
49
+ end
50
+
51
+ def self.details
52
+ 'Use this action to rename your unrelease section to your release version and add a new unreleased section to your project CHANGELOG.md'
53
+ end
54
+
55
+ def self.available_options
56
+ [
57
+ FastlaneCore::ConfigItem.new(key: :github_repo,
58
+ env_name: 'GITHUB_REPOSITORY',
59
+ description: 'The owner and repository name. For example, octocat/Hello-World',
60
+ is_string: true),
61
+ FastlaneCore::ConfigItem.new(key: :changelog_path,
62
+ env_name: 'FL_CHANGELOG_PATH',
63
+ description: 'The path to your project CHANGELOG.md',
64
+ is_string: true,
65
+ default_value: './CHANGELOG.md',
66
+ optional: true),
67
+ FastlaneCore::ConfigItem.new(key: :release_version,
68
+ env_name: 'FL_CHANGELOG_RELEASE_VERSION',
69
+ description: 'The release version, according to semantic versioning',
70
+ is_string: true,
71
+ default_value: '',
72
+ optional: false)
73
+ ]
74
+ end
75
+
76
+ def self.authors
77
+ ['b-onc']
78
+ end
79
+
80
+ def self.is_supported?(platform)
81
+ true
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module StreamActions
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/stream_actions/version'
2
+
3
+ module Fastlane
4
+ module StreamActions
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::StreamActions.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,256 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-stream_actions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - GetStream
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fasterer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: fastlane
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.182.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.182.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: plist
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec_junit_formatter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.12.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 1.12.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-rake
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 0.6.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 0.6.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-require_tools
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop-rspec
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '='
186
+ - !ruby/object:Gem::Version
187
+ version: 2.4.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '='
193
+ - !ruby/object:Gem::Version
194
+ version: 2.4.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: simplecov
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: xctest_list
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '='
214
+ - !ruby/object:Gem::Version
215
+ version: 1.2.1
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '='
221
+ - !ruby/object:Gem::Version
222
+ version: 1.2.1
223
+ description:
224
+ email: alexey.alterpesotskiy@getstream.io
225
+ executables: []
226
+ extensions: []
227
+ extra_rdoc_files: []
228
+ files:
229
+ - README.md
230
+ - lib/fastlane/plugin/stream_actions.rb
231
+ - lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb
232
+ - lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb
233
+ - lib/fastlane/plugin/stream_actions/version.rb
234
+ homepage: https://github.com/GetStream/fastlane-plugin-stream_actions
235
+ licenses: []
236
+ metadata: {}
237
+ post_install_message:
238
+ rdoc_options: []
239
+ require_paths:
240
+ - lib
241
+ required_ruby_version: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: '2.4'
246
+ required_rubygems_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ requirements: []
252
+ rubygems_version: 3.3.7
253
+ signing_key:
254
+ specification_version: 4
255
+ summary: stream custom actions
256
+ test_files: []