ci_toolkit 1.3.9 → 1.3.14

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: e28c272f3fdb72564c18cd2dc76dd575126d6a513fb00033a7e41327fc3fbc59
4
- data.tar.gz: 89f86604b9a8869886ba799f39d90961878353cbe7b1c54bc4d8d9bea81c4397
3
+ metadata.gz: 938a4dcc442b46bc5d98c53185a580047373c8f61db4f810c38b3109a418634c
4
+ data.tar.gz: 8a16209aaa97fc0368e39d6e61f4c645f1195187c6f206e9b3e2c10f0e5323b6
5
5
  SHA512:
6
- metadata.gz: 170db6c9cb9901615ee93a70deca455a96413fd68b9dad8eb728ae77efd442a8032ee10d06dad6300fd0aadc908e2527813f61bf47552a00ae7a7b6f143eb5ff
7
- data.tar.gz: 8802f0f9d2dc7fd8ccfc2b449f4cf37df326295c1e68dd8b97cb10954491a59c5274e1890cd3ef2d47fa7aecb80b3475ff76c2dabc0dbe812beab23601c9b82c
6
+ metadata.gz: 53a7cdf718680bb99a11d3398711c0a4f3df2b2a8d01434d79ef78b99f4a195b63917c10596f9c4874966655fee213cc4ddbfb9adf0001dd941d2456bf41ab92
7
+ data.tar.gz: bb209944bd1979e80be2ce97ff04ac06b94880751ffac8c25eea8715beb8a0c3d6c51d6a39444384546eeaf3dc42b52136ac8a75dfe913b376467e476d611b36
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.3.9)
4
+ ci_toolkit (1.3.14)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
@@ -15,6 +15,7 @@ GEM
15
15
  addressable (2.8.0)
16
16
  public_suffix (>= 2.0.2, < 5.0)
17
17
  ast (2.4.2)
18
+ date (3.2.0)
18
19
  diff-lcs (1.4.4)
19
20
  docile (1.4.0)
20
21
  faraday (1.8.0)
@@ -36,15 +37,17 @@ GEM
36
37
  faraday-net_http_persistent (1.2.0)
37
38
  faraday-patron (1.0.0)
38
39
  faraday-rack (1.0.0)
39
- faraday_middleware (1.1.0)
40
+ faraday_middleware (1.2.0)
40
41
  faraday (~> 1.0)
42
+ ipaddr (1.2.3)
41
43
  json (2.5.1)
42
44
  jwt (2.3.0)
43
45
  multipart-post (2.1.1)
44
46
  octokit (4.21.0)
45
47
  faraday (>= 0.9)
46
48
  sawyer (~> 0.8.0, >= 0.5.3)
47
- openssl (2.2.0)
49
+ openssl (2.2.1)
50
+ ipaddr
48
51
  parallel (1.21.0)
49
52
  parser (3.0.2.0)
50
53
  ast (~> 2.4.1)
@@ -95,11 +98,13 @@ GEM
95
98
  json
96
99
  simplecov
97
100
  simplecov_json_formatter (0.1.3)
98
- time (0.1.0)
101
+ time (0.2.0)
102
+ date
99
103
  unicode-display_width (2.1.0)
100
104
 
101
105
  PLATFORMS
102
106
  universal-darwin-20
107
+ x86_64-darwin-21
103
108
  x86_64-linux
104
109
 
105
110
  DEPENDENCIES
@@ -113,4 +118,4 @@ DEPENDENCIES
113
118
  simplecov-json
114
119
 
115
120
  BUNDLED WITH
116
- 2.2.27
121
+ 2.2.30
@@ -19,51 +19,50 @@ module CiToolkit
19
19
  @build_number = options[:build_number].to_i
20
20
  @token = options[:token]
21
21
  @app_slug = options[:app_slug]
22
- @connection = faraday
23
- configure_connection
22
+ @connection = faraday || create_connection
24
23
  end
25
24
 
26
- def configure_connection
27
- return unless @connection.nil?
28
-
29
- @connection = Faraday.new(
25
+ def create_connection
26
+ connection = Faraday.new(
30
27
  url: "https://api.bitrise.io",
31
28
  headers: { "Content-Type" => "application/json", "Authorization" => @token }
32
29
  )
33
- @connection.use Faraday::Request::UrlEncoded
34
- @connection.use Faraday::Request::Retry
35
- @connection.use FaradayMiddleware::EncodeJson
36
- @connection.use FaradayMiddleware::ParseJson
37
- @connection.use FaradayMiddleware::FollowRedirects
30
+ connection.use Faraday::Request::UrlEncoded
31
+ connection.use Faraday::Request::Retry
32
+ connection.use FaradayMiddleware::EncodeJson
33
+ connection.use FaradayMiddleware::ParseJson
34
+ connection.use FaradayMiddleware::FollowRedirects
35
+
36
+ connection
38
37
  end
39
38
 
40
39
  def create_pull_request_build(pull_request, branch, commit, workflow)
41
- @connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds", {
42
- hook_info: { type: "bitrise" },
43
- build_params: {
44
- branch: branch,
45
- branch_dest: "develop",
46
- pull_request_id: pull_request,
47
- workflow_id: workflow,
48
- commit_hash: commit
49
- }
50
- })
40
+ @connection.post("/#{API_VERSION}/apps/#{@app_slug}/builds", {
41
+ hook_info: { type: "bitrise" },
42
+ build_params: {
43
+ branch: branch,
44
+ branch_dest: "develop",
45
+ pull_request_id: pull_request,
46
+ workflow_id: workflow,
47
+ commit_hash: commit
48
+ }
49
+ })
51
50
  end
52
51
 
53
52
  def abort_pull_request_builds(pull_request, branch, commit)
54
53
  find_pull_request_builds(pull_request, branch, commit).each do |build|
55
- @connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
56
- abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
57
- })
54
+ @connection.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
55
+ abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
56
+ })
58
57
  end
59
58
  end
60
59
 
61
60
  def find_pull_request_builds(pull_request, branch, commit)
62
- response = @connection&.get("/#{API_VERSION}/apps/#{@app_slug}/builds", {
63
- branch: branch,
64
- pull_request_id: pull_request.to_i,
65
- status: 0 # status: 0 == not finished
66
- })
61
+ response = @connection.get("/#{API_VERSION}/apps/#{@app_slug}/builds", {
62
+ branch: branch,
63
+ pull_request_id: pull_request.to_i,
64
+ status: 0 # status: 0 == not finished
65
+ })
67
66
  builds = response.body["data"]
68
67
  filter_builds_by_commit(builds, commit)
69
68
  end
@@ -42,7 +42,7 @@ module CiToolkit
42
42
 
43
43
  def delete_comments_including_text(text)
44
44
  comments = find_comments_including_text(text)
45
- comments.each { |comment| delete_comment(comment[:id]) unless comment.nil? }
45
+ comments.each { |comment| delete_comment(comment[:id]) }
46
46
  end
47
47
 
48
48
  def delete_comment(comment_id)
@@ -61,6 +61,10 @@ module CiToolkit
61
61
  client.labels_for_issue(@repo_slug, @pr_number).map { |item| item[:name] }
62
62
  end
63
63
 
64
+ def files
65
+ client.pull_request_files(@repo_slug, @pr_number)
66
+ end
67
+
64
68
  def create_status(state, context, target_url, description)
65
69
  client.create_status(
66
70
  @repo_slug,
@@ -74,6 +78,7 @@ module CiToolkit
74
78
  client.statuses(@repo_slug, @commit_sha).each do |status|
75
79
  return status if status[:context] == context
76
80
  end
81
+ nil
77
82
  end
78
83
 
79
84
  def build_types
@@ -96,6 +101,11 @@ module CiToolkit
96
101
  lines_of_code_changed > 500
97
102
  end
98
103
 
104
+ def realm_module_modified?
105
+ modified_files = files.select { |file| file[:filename]&.start_with? "cache/" }
106
+ modified_files.length.positive?
107
+ end
108
+
99
109
  private
100
110
 
101
111
  def client
@@ -46,6 +46,15 @@ module CiToolkit
46
46
  delete(@messenger_text.lint_report_title)
47
47
  end
48
48
 
49
+ def send_realm_modified_warning
50
+ delete_realm_modified_warning
51
+ send(@messenger_text.realm_modified_warning_title)
52
+ end
53
+
54
+ def delete_realm_modified_warning
55
+ delete(@messenger_text.realm_modified_warning_title)
56
+ end
57
+
49
58
  def send_big_pr_warning
50
59
  delete_big_pr_warning
51
60
  send(@messenger_text.big_pr_warning_title)
@@ -41,6 +41,10 @@ module CiToolkit
41
41
  "#### Swiftlint report 🕵️‍♀️"
42
42
  end
43
43
 
44
+ def realm_modified_warning_title
45
+ warning_with_message("Realm module modified. Did you remember to add migrations?")
46
+ end
47
+
44
48
  def big_pr_warning_title
45
49
  warning_with_message("Big PR")
46
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CiToolkit
4
- VERSION = "1.3.9"
4
+ VERSION = "1.3.14"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-06 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday