fastlane-plugin-stream_actions 0.1.16 → 0.1.18

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: b4f4cb310ffff11e9c81c8b5838906e12e70375acf736733c36750ac69fbf873
4
- data.tar.gz: 5f79a9699b893bc7000215f5fc3b705fa7f7cf1836b6f35677e73f4ee71b6803
3
+ metadata.gz: e8aedf213b38a187944b2dce1a10bf6e01a16c1d1a41c2a5ff1aeac786001efb
4
+ data.tar.gz: 39abbf45af37a5c33a4fba0d25f41b66c7416dde5e30290cb614f1c03f2dcc9e
5
5
  SHA512:
6
- metadata.gz: c93a99d94c8163f649b4603a51176f026e35ab360c1d5ba17298a7c2d6e7cf54605a5709e5d7db15dc429d3823623f6d0527dab809c9ea52105347e96c798ad1
7
- data.tar.gz: ed5168b819dec5dec92d76cd5d63b0d486e7b7671fb651f7e497ec691be6a28756767b6790729644c656fbc615a4beeb8077b8fe1aeeb1d75914702bcd36a873
6
+ metadata.gz: b189951490a9e95b4534460c6fbbb408472394c8db19ce98b2892ba08b1562ad71b6a3e3a7b03bddfd6ba208855b457afa0b210a0d3136d593c651ef192c6e2d
7
+ data.tar.gz: 5229f877e3b325785025148182500bada877d9bc46e4c3f0a7612264699438649bc07950c90223e82185efb0758153d1e15457e316dbacc42a27cc3fd90ba6aa
@@ -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
@@ -0,0 +1,46 @@
1
+ module Fastlane
2
+ module Actions
3
+ class PodPushSafelyAction < Action
4
+ def self.run(params)
5
+ pod_push_safely(params)
6
+ end
7
+
8
+ def self.pod_push_safely(params)
9
+ UI.message("Starting to push podspec: #{params[:podspec]}")
10
+ other_action.pod_push(path: params[:podspec], allow_warnings: true, synchronous: params[:sync])
11
+ rescue StandardError => e
12
+ UI.message(e)
13
+ UI.message("pod_push failed for #{params[:podspec]}. Waiting a minute until retry for trunk to get updated...")
14
+ sleep(60) # sleep for a minute, wait until trunk gets updates
15
+ pod_push_safely(params)
16
+ end
17
+
18
+ #####################################################
19
+ # @!group Documentation
20
+ #####################################################
21
+
22
+ def self.description
23
+ 'Safely push a Podspec to Trunk or a private repository'
24
+ end
25
+
26
+ def self.available_options
27
+ [
28
+ FastlaneCore::ConfigItem.new(
29
+ key: :podspec,
30
+ description: 'The Podspec you want to push'
31
+ ),
32
+ FastlaneCore::ConfigItem.new(
33
+ key: :sync,
34
+ description: 'If validation depends on other recently pushed pods, synchronize',
35
+ is_string: false,
36
+ default_value: false
37
+ )
38
+ ]
39
+ end
40
+
41
+ def self.supported?(_platform)
42
+ [:ios].include?(platform)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -37,7 +37,7 @@ module Fastlane
37
37
  commitish: ENV['BRANCH_NAME'] || other_action.git_branch
38
38
  )
39
39
 
40
- podspecs.each { |podspec| pod_push_safely(podspec: podspec, sync: params[:pod_sync] & true) }
40
+ podspecs.each { |podspec| other_action.pod_push_safely(podspec: podspec, sync: params[:pod_sync] & true) }
41
41
 
42
42
  UI.success("Github release v#{version_number} was created, please visit #{release_details['html_url']} to see it! 🚢")
43
43
  end
@@ -69,16 +69,6 @@ module Fastlane
69
69
  other_action.push_to_git_remote(tags: true)
70
70
  end
71
71
 
72
- def self.pod_push_safely(params)
73
- UI.message("Starting to push podspec: #{params[:podspec]}")
74
- other_action.pod_push(path: params[:podspec], allow_warnings: true, synchronous: params[:sync])
75
- rescue StandardError => e
76
- UI.message(e)
77
- UI.message("pod_push failed for #{params[:podspec]}. Waiting a minute until retry for trunk to get updated...")
78
- sleep(60) # sleep for a minute, wait until trunk gets updates
79
- pod_push_safely(params)
80
- end
81
-
82
72
  #####################################################
83
73
  # @!group Documentation
84
74
  #####################################################
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = "0.1.16"
3
+ VERSION = "0.1.18"
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.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-06 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -228,8 +228,13 @@ 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
237
+ - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
233
238
  - lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
234
239
  - lib/fastlane/plugin/stream_actions/actions/release_ios_sdk.rb
235
240
  - lib/fastlane/plugin/stream_actions/actions/retrieve_xctest_names.rb