fastlane-plugin-stream_actions 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -4
- data/lib/fastlane/plugin/stream_actions/actions/is_check_required.rb +54 -0
- data/lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb +50 -0
- data/lib/fastlane/plugin/stream_actions/actions/read_changelog.rb +52 -0
- data/lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb +0 -4
- data/lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb +0 -4
- data/lib/fastlane/plugin/stream_actions/actions/update_testplan.rb +49 -0
- 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: b371315771d583d26a5f3f02f3351bff63f478df1ec13ceed722acbd01088d31
|
4
|
+
data.tar.gz: ab066f89eb0ddd79ad02fed2ec92c1e712ae99d69074055f8a8e16927994ec58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e56722b269ec5d8b3507d391a662ba15737789d221b30c4848dad642cc019851893676d8e8b027b43e35b353129166be14e3ec94a729844abf63336b238b699
|
7
|
+
data.tar.gz: 584effd580b5fc8f0b3a795e107c3001b0f9b7b02ea87cff31fc30de33412135e75456b32b27cff24f1dd31172dd9dd7d792c42aea55c7288df84a5b5952dd00
|
data/README.md
CHANGED
@@ -10,10 +10,7 @@ gem 'fastlane-plugin-stream_actions'
|
|
10
10
|
|
11
11
|
## About stream_actions
|
12
12
|
|
13
|
-
|
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 | |
|
13
|
+
Stream Actions are used to share the codebase and automate the release process for Stream SDKs.
|
17
14
|
|
18
15
|
## Start working on this plugin
|
19
16
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
require 'fastlane/actions/xcodebuild'
|
4
|
+
|
5
|
+
class IsCheckRequired < Action
|
6
|
+
def self.run(params)
|
7
|
+
return true if ENV['GITHUB_EVENT_NAME'] != 'pull_request'
|
8
|
+
|
9
|
+
pr_number = JSON.parse(ENV['GITHUB_EVENT'])['pull_request']['number']
|
10
|
+
|
11
|
+
changed_files = sh("gh pr view #{pr_number} --json files -q '.files[].path'").split("\n")
|
12
|
+
|
13
|
+
return true if changed_files.size == 100 # TODO: https://github.com/cli/cli/issues/5368
|
14
|
+
|
15
|
+
changed_files.select! do |path|
|
16
|
+
params[:sources][params[:type].to_sym].any? { |required| path.start_with?(required) }
|
17
|
+
end
|
18
|
+
|
19
|
+
changed_files.size.positive?
|
20
|
+
end
|
21
|
+
|
22
|
+
#####################################################
|
23
|
+
# @!group Documentation
|
24
|
+
#####################################################
|
25
|
+
|
26
|
+
def self.description
|
27
|
+
'Analyzes the impact of changes on PR'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.available_options
|
31
|
+
[
|
32
|
+
FastlaneCore::ConfigItem.new(
|
33
|
+
key: :sources,
|
34
|
+
description: 'Array of paths to scan',
|
35
|
+
verify_block: proc do |source|
|
36
|
+
UI.user_error!("Sources have to be specified") unless source
|
37
|
+
end
|
38
|
+
),
|
39
|
+
FastlaneCore::ConfigItem.new(
|
40
|
+
key: :type,
|
41
|
+
description: 'Type of the check that was triggered',
|
42
|
+
verify_block: proc do |type|
|
43
|
+
UI.user_error!("Type has to be specified") unless type
|
44
|
+
end
|
45
|
+
)
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.supported?(_platform)
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
require 'fastlane/actions/xcodebuild'
|
4
|
+
|
5
|
+
class PodPushSafely < Action
|
6
|
+
def self.run(params)
|
7
|
+
pod_push_safely(params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.pod_push_safely(params)
|
11
|
+
UI.message("Starting to push podspec: #{params[:podspec]}")
|
12
|
+
Fastlane::Actions::PodPushAction.run(path: params[:podspec], allow_warnings: true, synchronous: params[:sync])
|
13
|
+
rescue StandardError => e
|
14
|
+
UI.message(e)
|
15
|
+
UI.message("pod_push failed for #{params[:podspec]}. Waiting a minute until retry for trunk to get updated...")
|
16
|
+
sleep(60) # sleep for a minute, wait until trunk gets updates
|
17
|
+
pod_push_safely(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
#####################################################
|
21
|
+
# @!group Documentation
|
22
|
+
#####################################################
|
23
|
+
|
24
|
+
def self.description
|
25
|
+
'Releases pod to cocoapods trunk'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_options
|
29
|
+
[
|
30
|
+
FastlaneCore::ConfigItem.new(
|
31
|
+
key: :podspec,
|
32
|
+
description: 'Podspec path',
|
33
|
+
verify_block: proc do |pod|
|
34
|
+
UI.user_error!("Podspec path has to be specified") unless pod
|
35
|
+
end
|
36
|
+
),
|
37
|
+
FastlaneCore::ConfigItem.new(
|
38
|
+
key: :sync,
|
39
|
+
description: 'When `sync` is false, pod trunk push is run asynchronously',
|
40
|
+
is_string: false
|
41
|
+
)
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.supported?(_platform)
|
46
|
+
[:ios].include?(platform)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class ReadChangelog < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.user_error!('You need to pass the version of the release you want to obtain the changelog from') unless options[:version]
|
6
|
+
|
7
|
+
UI.message("Getting changelog for #{options[:version]}")
|
8
|
+
reading_changelog = false
|
9
|
+
changes = ''
|
10
|
+
changelog_lines = File.readlines('../CHANGELOG.md')
|
11
|
+
changelog_lines.each do |line|
|
12
|
+
start_token = '# ['
|
13
|
+
if reading_changelog
|
14
|
+
break if line.start_with?(start_token)
|
15
|
+
|
16
|
+
changes << line
|
17
|
+
end
|
18
|
+
|
19
|
+
reading_changelog = true if line.start_with?("#{start_token}#{options[:version]}")
|
20
|
+
end
|
21
|
+
|
22
|
+
UI.user_error!("No changelog found for #{options[:version]}") unless changes.length > 0
|
23
|
+
UI.success("Changelog for #{options[:version]}: \n#{changes}")
|
24
|
+
changes
|
25
|
+
end
|
26
|
+
|
27
|
+
#####################################################
|
28
|
+
# @!group Documentation
|
29
|
+
#####################################################
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
'Gets updates from the CHANGELOG.md'
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(
|
38
|
+
key: :version,
|
39
|
+
description: 'Release version',
|
40
|
+
verify_block: proc do |v|
|
41
|
+
UI.user_error!("You need to pass the version of the release you want to obtain the changelog from") unless v
|
42
|
+
end
|
43
|
+
)
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.supported?(_platform)
|
48
|
+
[:ios].include?(platform)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class UpdateTestplan < Action
|
4
|
+
def self.run(params)
|
5
|
+
data_hash = JSON.parse(File.read(params[:path]))
|
6
|
+
|
7
|
+
# Create the `environmentVariableEntries` array if it doesn't exist
|
8
|
+
data_hash['defaultOptions']['environmentVariableEntries'] ||= []
|
9
|
+
|
10
|
+
data_hash['defaultOptions']['environmentVariableEntries'] << params[:env_vars]
|
11
|
+
File.write(test_plan_file, JSON.pretty_generate(data_hash))
|
12
|
+
|
13
|
+
UI.success("✅ `#{params[:env_vars]}` ENV variables have been added to #{params[:path]}")
|
14
|
+
UI.message("👀 #{params[:path]} ENV variables:\n#{data_hash['defaultOptions']['environmentVariableEntries']}")
|
15
|
+
end
|
16
|
+
|
17
|
+
#####################################################
|
18
|
+
# @!group Documentation
|
19
|
+
#####################################################
|
20
|
+
|
21
|
+
def self.description
|
22
|
+
'Retrieves test names from xctestrun file'
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.available_options
|
26
|
+
[
|
27
|
+
FastlaneCore::ConfigItem.new(
|
28
|
+
key: :path,
|
29
|
+
description: 'The test plan file path',
|
30
|
+
verify_block: proc do |path|
|
31
|
+
UI.user_error!("Cannot find the testplan file '#{path}'") unless File.exist?(path)
|
32
|
+
end
|
33
|
+
),
|
34
|
+
FastlaneCore::ConfigItem.new(
|
35
|
+
key: :env_vars,
|
36
|
+
description: 'The environment variables to add to test plan',
|
37
|
+
verify_block: proc do |path|
|
38
|
+
UI.user_error!("The environment variables array should not be empty") if env_vars.empty?
|
39
|
+
end
|
40
|
+
)
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.supported?(_platform)
|
45
|
+
[:ios].include?(platform)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GetStream
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -228,8 +228,12 @@ extra_rdoc_files: []
|
|
228
228
|
files:
|
229
229
|
- README.md
|
230
230
|
- lib/fastlane/plugin/stream_actions.rb
|
231
|
+
- lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
|
232
|
+
- lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
|
233
|
+
- lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
|
231
234
|
- lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb
|
232
235
|
- lib/fastlane/plugin/stream_actions/actions/touch_changelog.rb
|
236
|
+
- lib/fastlane/plugin/stream_actions/actions/update_testplan.rb
|
233
237
|
- lib/fastlane/plugin/stream_actions/version.rb
|
234
238
|
homepage: https://github.com/GetStream/fastlane-plugin-stream_actions
|
235
239
|
licenses: []
|