fastlane-plugin-stream_actions 0.1.17 → 0.1.19

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: 1e09a263ddb2f9ee18214a8076d11ec1a455147f19a960d4a0d73259028d7f7c
4
- data.tar.gz: 1f6bbd93c2c912b7c4978fcccb004ee927c59f8c59f67d977d22a6ea0ac2082f
3
+ metadata.gz: 7036b906f218b2b7edf62c58727acf6b1676c1d843fc51980b5c82fa83ba3454
4
+ data.tar.gz: 543be4987c03ee0ea18eb75920c55dbdf1f539ae79d622cfc1bbb35fee712610
5
5
  SHA512:
6
- metadata.gz: 87878e73b99f8607854939d954fdaafe52322a5536c3ba972950a8b811be409c055c642106aa4a4a4787082d0c44a4687de736425ebcc8b40e9e52e050aee05c
7
- data.tar.gz: 8fa6b9690bda755495b4425d126190f79c39f8812d1aa91b0932aa3f7e63710cbd5204a2aba2cf52d58c30117b4b7aad0fa9e7e4d75b0726e844aad280b66fe0
6
+ metadata.gz: 36bfaf38e255b86cea9abf0d65412cd460221287b336b75c111f06998f2212c9f7999b5dabfa4cbebd774a4fb1d1e4ed5efdf21dd63334b693dbc776ccad975d
7
+ data.tar.gz: bbfd06f46a23bc2474882bc522dd9ad7e4e014270ce9df543fefe0e4042b77f261e23841d4c8ebff934565bea70f87d916d685dac95c127869f34ede0fd97ab3
@@ -0,0 +1,74 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AllureApiAction < Action
4
+ def self.run(params)
5
+ url = URI("#{params[:url]}/api/rs/#{options[:endpoint]}")
6
+ request =
7
+ case options[:http_method].upcase
8
+ when 'GET'
9
+ Net::HTTP::Get.new(url)
10
+ when 'POST'
11
+ Net::HTTP::Post.new(url)
12
+ when 'PATCH'
13
+ Net::HTTP::Patch.new(url)
14
+ when 'DELETE'
15
+ Net::HTTP::Delete.new(url)
16
+ end
17
+ http = Net::HTTP.new(url.host, url.port)
18
+ http.use_ssl = true
19
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
20
+
21
+ request['authorization'] = "Api-Token #{params[:token]}"
22
+ request['content-type'] = 'application/json'
23
+ request.body = options[:request_body] if options[:request_body]
24
+
25
+ response_body = http.request(request).read_body
26
+ JSON.parse(response_body) if !response_body.nil? && !response_body.empty?
27
+ end
28
+
29
+ #####################################################
30
+ # @!group Documentation
31
+ #####################################################
32
+
33
+ def self.description
34
+ 'Allure Testops API'
35
+ end
36
+
37
+ def self.available_options
38
+ [
39
+ FastlaneCore::ConfigItem.new(
40
+ env_name: 'ALLURE_TOKEN',
41
+ key: :token,
42
+ description: 'Allure API Token'
43
+ ),
44
+ FastlaneCore::ConfigItem.new(
45
+ key: :url,
46
+ description: 'Testops URL'
47
+ ),
48
+ FastlaneCore::ConfigItem.new(
49
+ key: :path,
50
+ description: 'Allure Testops endpoint path'
51
+ ),
52
+ FastlaneCore::ConfigItem.new(
53
+ key: :request_body,
54
+ description: 'Request body',
55
+ optional: true
56
+ ),
57
+ FastlaneCore::ConfigItem.new(
58
+ key: :http_method,
59
+ description: 'HTTP request method',
60
+ verify_block: proc do |method|
61
+ unless ['GET', 'POST', 'PATCH', 'DELETE'].include?(method)
62
+ UI.user_error!('Path to the Xcode project has to be specified')
63
+ end
64
+ end
65
+ )
66
+ ]
67
+ end
68
+
69
+ def self.supported?(_platform)
70
+ true
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,97 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AllureCreateLaunchAction < Action
4
+ def self.run(params)
5
+ tags = []
6
+
7
+ launch_name =
8
+ if params[:cron]
9
+ 'Cron checks'
10
+ elsif params[:github_run_details].nil?
11
+ 'Local checks'
12
+ elsif params[:github_event_name] == 'pull_request'
13
+ pull_request = JSON.parse(params[:github_event])['pull_request']
14
+ tags = pull_request['labels'].map { |label| { name: label['name'] } }
15
+ pull_request['title']
16
+ elsif params[:github_run_details]['head_commit']
17
+ params[:github_run_details]['head_commit']['message']
18
+ else
19
+ params[:github_run_details]['name']
20
+ end
21
+
22
+ body = {
23
+ projectId: params[:project_id],
24
+ name: launch_name,
25
+ tags: tags,
26
+ autoclose: false,
27
+ closed: false
28
+ }.to_json
29
+
30
+ launch_id = other_action.allure_api(
31
+ url: params[:url],
32
+ token: params[:token],
33
+ path: '/launch',
34
+ http_method: 'POST',
35
+ body: body
36
+ )['id']
37
+
38
+ UI.success("Launch with id #{launch_id} created successfully 🎉")
39
+ launch_id
40
+ end
41
+
42
+ #####################################################
43
+ # @!group Documentation
44
+ #####################################################
45
+
46
+ def self.description
47
+ 'Creates launch on Allure Testops'
48
+ end
49
+
50
+ def self.available_options
51
+ [
52
+ FastlaneCore::ConfigItem.new(
53
+ env_name: 'ALLURE_TOKEN',
54
+ key: :token,
55
+ description: 'Allure API Token'
56
+ ),
57
+ FastlaneCore::ConfigItem.new(
58
+ key: :url,
59
+ description: 'Testops URL'
60
+ ),
61
+ FastlaneCore::ConfigItem.new(
62
+ key: :github_run_details,
63
+ description: 'Github run details json',
64
+ is_string: false,
65
+ optional: true
66
+ ),
67
+ FastlaneCore::ConfigItem.new(
68
+ env_name: 'GITHUB_EVENT_NAME',
69
+ key: :github_event_name,
70
+ description: 'Github event name',
71
+ optional: true
72
+ ),
73
+ FastlaneCore::ConfigItem.new(
74
+ env_name: 'GITHUB_EVENT',
75
+ key: :github_event,
76
+ description: 'Github Actions: toJson(github.event)',
77
+ optional: true
78
+ ),
79
+ FastlaneCore::ConfigItem.new(
80
+ key: :project_id,
81
+ description: 'Project identifier in Allure Testops'
82
+ ),
83
+ FastlaneCore::ConfigItem.new(
84
+ key: :cron,
85
+ description: 'Is this a cron job?',
86
+ is_string: false,
87
+ optional: true
88
+ )
89
+ ]
90
+ end
91
+
92
+ def self.supported?(_platform)
93
+ true
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,50 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AllureCreateTestcaseAction < Action
4
+ def self.run(params)
5
+ body = { projectId: params[:project_id], name: 'Automatically created testcase', deleted: true }.to_json
6
+
7
+ testcase_id = other_action.allure_api(
8
+ url: params[:url],
9
+ token: params[:token],
10
+ path: '/testcase',
11
+ http_method: 'POST',
12
+ body: body
13
+ )['id']
14
+
15
+ UI.success("Testcase with id #{testcase_id} created successfully 🎉")
16
+ testcase_id
17
+ end
18
+
19
+ #####################################################
20
+ # @!group Documentation
21
+ #####################################################
22
+
23
+ def self.description
24
+ 'Creates testcase on Allure Testops'
25
+ end
26
+
27
+ def self.available_options
28
+ [
29
+ FastlaneCore::ConfigItem.new(
30
+ env_name: 'ALLURE_TOKEN',
31
+ key: :token,
32
+ description: 'Allure API Token'
33
+ ),
34
+ FastlaneCore::ConfigItem.new(
35
+ key: :url,
36
+ description: 'Testops URL'
37
+ ),
38
+ FastlaneCore::ConfigItem.new(
39
+ key: :project_id,
40
+ description: 'Project identifier in Allure Testops'
41
+ )
42
+ ]
43
+ end
44
+
45
+ def self.supported?(_platform)
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,82 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AllureRunTestplanAction < Action
4
+ def self.run(params)
5
+ response = other_action.allure_api(
6
+ url: params[:url],
7
+ token: params[:token],
8
+ path: "/testplan/?projectId=#{params[:project_id]}",
9
+ http_method: 'GET'
10
+ )
11
+
12
+ testplan_id = response['content'].find { |plan| plan['name'] == params[:testplan] }['id']
13
+
14
+ other_action.allure_api(
15
+ url: params[:url],
16
+ token: params[:token],
17
+ path: "/testplan/#{testplan_id}/sync",
18
+ http_method: 'POST'
19
+ )
20
+ UI.success("#{rocket}\nTestplan with id #{testplan_id} synced successfully 🎉")
21
+
22
+ body = {
23
+ launchName: "#{params[:testplan]} #{params[:release_version]}",
24
+ links: [{ name: 'Jira', url: params[:jira] }]
25
+ }.to_json
26
+
27
+ other_action.allure_api(
28
+ url: params[:url],
29
+ token: params[:token],
30
+ path: "/testplan/#{testplan_id}/run",
31
+ http_method: 'POST',
32
+ body: body
33
+ )
34
+ UI.success("#{rocket}\nTestplan with id #{testplan_id} launched successfully 🎉")
35
+ end
36
+
37
+ #####################################################
38
+ # @!group Documentation
39
+ #####################################################
40
+
41
+ def self.description
42
+ 'Sync and run testplan on Allure Testops'
43
+ end
44
+
45
+ def self.available_options
46
+ [
47
+ FastlaneCore::ConfigItem.new(
48
+ env_name: 'ALLURE_TOKEN',
49
+ key: :token,
50
+ description: 'Allure API Token'
51
+ ),
52
+ FastlaneCore::ConfigItem.new(
53
+ key: :url,
54
+ description: 'Testops URL'
55
+ ),
56
+ FastlaneCore::ConfigItem.new(
57
+ key: :release_version,
58
+ description: 'Release version',
59
+ optional: true
60
+ ),
61
+ FastlaneCore::ConfigItem.new(
62
+ key: :testplan,
63
+ description: 'Testplan name in Allure Testops'
64
+ ),
65
+ FastlaneCore::ConfigItem.new(
66
+ key: :project_id,
67
+ description: 'Project identifier in Allure Testops'
68
+ ),
69
+ FastlaneCore::ConfigItem.new(
70
+ key: :jira,
71
+ description: 'Jira link',
72
+ default_value: 'Default'
73
+ )
74
+ ]
75
+ end
76
+
77
+ def self.supported?(_platform)
78
+ true
79
+ end
80
+ end
81
+ end
82
+ end
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class IsCheckRequiredAction < Action
4
4
  def self.run(params)
5
- return true if params[:github_pr_num].nil? || params[:github_pr_num].empty?
5
+ return true if params[:github_pr_num].nil? || params[:github_pr_num].strip.empty?
6
6
 
7
7
  UI.message("Checking if check is required for PR ##{params[:github_pr_num]}")
8
8
 
@@ -34,7 +34,7 @@ module Fastlane
34
34
  changelog: testflight_instructions(params)
35
35
  )
36
36
 
37
- if params[:github_pr_num]
37
+ if params[:github_pr_num] && !params[:github_pr_num].strip.empty?
38
38
  message = "Build for regression testing №#{build_number} has been uploaded to TestFlight 🎁"
39
39
  sh("gh pr comment #{params[:github_pr_num]} -b '#{message}'")
40
40
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = "0.1.17"
3
+ VERSION = "0.1.19"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
@@ -228,6 +228,10 @@ 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/allure_api.rb
232
+ - lib/fastlane/plugin/stream_actions/actions/allure_create_launch.rb
233
+ - lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb
234
+ - lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb
231
235
  - lib/fastlane/plugin/stream_actions/actions/custom_match.rb
232
236
  - lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
233
237
  - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb