fastlane-plugin-stream_actions 0.4.4 → 0.4.6

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: c822fdfad8f332a11b18881d8c1a57861942c71e148b6fb4a51720fe28ec5f99
4
- data.tar.gz: 828397123a0ae1995d7c7d4a5cd7cfcbc5b1ad3276e594f265b312aa024a1194
3
+ metadata.gz: f167f7e71ba5f2f1e4c5e7f8f82bed780115104efd56b8cdfb7694bf8e2f2cc9
4
+ data.tar.gz: d3c46876b539bedb30dde0c4c9bae24f06f6f17270dd1d15ba71016d90f15678
5
5
  SHA512:
6
- metadata.gz: 22683a0374246a7d4c98b7274fe13e7f98aa1649c386fba1f33953d888e7be8e7605838ce122e367a73725a9eb76258bfa6bf7a1f354d28c9fabe6e62b189a02
7
- data.tar.gz: 8dfedadc11a5e46a23674caecb46bf71835793244475aecbde062d4d4993ff87dadb46693150b656da8ae1d0ba13e598f3e69e609aa64ea1ab9c5ee680aa14e8
6
+ metadata.gz: 63a95e3b242b4f75dc39172b46a80f81fabb2ce2f0cf8a22467905670ef23f06b967f4e3f7c2fec242b48f4233870865c9cc0ba75dfe104a86f18f03214da178
7
+ data.tar.gz: d830ff076ec3d1fff8a39c92f15eee970608f1799b14f1db0144af1bcd2e5081c57c1dc1428fcf51c3db605c38202e24f0caa84d3d5bdbee28e1e268d7508958
@@ -25,8 +25,8 @@ module Fastlane
25
25
  return false
26
26
  end
27
27
 
28
- # The current push does not touch :sources. It is only safe to skip if the last commit that
29
- # did change :sources had all required checks pass; otherwise :sources were never verified.
28
+ # The current push does not touch :sources. It is only safe to skip if :sources were already
29
+ # verified, i.e. all required checks passed on some commit that has the current :sources tree.
30
30
  is_check_required = self.required_due_to_history(params, required_checks)
31
31
  UI.important("Check is required: #{is_check_required}")
32
32
  is_check_required
@@ -36,8 +36,9 @@ module Fastlane
36
36
  files.any? { |path| sources.any? { |required| path.start_with?(required) } }
37
37
  end
38
38
 
39
- # Walks the PR commits from newest to oldest until the last commit that changed :sources is
40
- # found, then returns whether the check must run based on that commit's required check runs.
39
+ # Walks the PR commits from newest to oldest. Every commit newer than the last :sources change
40
+ # has the current :sources tree, so a passing run on any of them means :sources were verified.
41
+ # The walk stops at the commit that changed :sources, since older commits have different sources.
41
42
  def self.required_due_to_history(params, required_checks)
42
43
  repo = (params[:github_repository] || ENV['GITHUB_REPOSITORY']).to_s
43
44
  if repo.empty?
@@ -51,20 +52,21 @@ module Fastlane
51
52
  return true
52
53
  end
53
54
 
54
- sources_sha = shas.find { |sha| self.touches_sources?(self.commit_files(repo, sha), params[:sources]) }
55
- if sources_sha.nil?
56
- UI.message("No commit in this PR changed sources; nothing to test")
57
- return false
58
- end
55
+ shas.each do |sha|
56
+ short = sha[0, 7]
57
+ if self.required_checks_passed?(repo, sha, required_checks)
58
+ UI.message("Commit #{short} passed required checks for the current sources; safe to skip")
59
+ return false
60
+ end
59
61
 
60
- short = sources_sha[0, 7]
61
- if self.required_checks_passed?(repo, sources_sha, required_checks)
62
- UI.message("Last sources commit #{short} passed required checks; safe to skip")
63
- false
64
- else
65
- UI.important("Last sources commit #{short} did not pass required checks; running check")
66
- true
62
+ next unless self.touches_sources?(self.commit_files(repo, sha), params[:sources])
63
+
64
+ UI.important("Last sources commit #{short} was not verified by a passing run; running check")
65
+ return true
67
66
  end
67
+
68
+ UI.message("No commit in this PR changed sources; nothing to test")
69
+ false
68
70
  end
69
71
 
70
72
  # PR commits, newest first (gh returns them oldest first).
@@ -153,14 +155,47 @@ module Fastlane
153
155
  #####################################################
154
156
 
155
157
  def self.description
156
- 'Analyzes the impact of changes on PR'
158
+ 'Decides whether a CI check (tests, build, etc.) needs to run for the current pull request state'
159
+ end
160
+
161
+ def self.details
162
+ <<~DETAILS
163
+ Skips CI work that has nothing to verify, without ever skipping work that has not been verified yet.
164
+
165
+ The action inspects which files changed and returns:
166
+ - true -> the caller should run the check
167
+ - false -> the caller can safely skip it (usually via `next unless is_check_required(...)`)
168
+
169
+ How the decision is made:
170
+ 1. If `force_check` is set, or no PR number is available (e.g. a push to a branch), it returns true.
171
+ 2. It collects the changed files. On a `synchronize` event with `github_event_before`/`after`, only
172
+ the files in that single push are considered; otherwise the whole PR diff is used.
173
+ 3. If more than 99 files changed, it returns true (the GitHub CLI cannot reliably list more).
174
+ 4. If any changed file lives under one of `sources`, the check is relevant -> returns true.
175
+ 5. If no changed file touches `sources`:
176
+ - With no `required_checks`, it returns false (nothing relevant changed in this push).
177
+ - With `required_checks`, it confirms the sources were actually verified before skipping. It walks
178
+ the PR commits newest-to-oldest: every commit newer than the last `sources` change shares the
179
+ current source tree, so if all `required_checks` concluded `success` on any of them, the sources
180
+ are proven and it returns false. The walk stops at the commit that changed `sources` (older
181
+ commits carry different sources); if none of them passed, the sources are unverified -> true.
182
+ If `sources` were never changed anywhere in the PR, there is nothing to test -> false.
183
+
184
+ This is what prevents a docs-only follow-up commit (e.g. editing CHANGELOG.md) from skipping tests
185
+ when the underlying source changes never passed CI.
186
+ DETAILS
187
+ end
188
+
189
+ def self.return_value
190
+ 'Boolean. true when the check should run, false when it can be safely skipped for the current PR state.'
157
191
  end
158
192
 
159
193
  def self.available_options
160
194
  [
161
195
  FastlaneCore::ConfigItem.new(
162
196
  key: :sources,
163
- description: 'Array of paths to scan',
197
+ description: 'Paths the check cares about. If a changed file path starts with any of these, the ' \
198
+ 'check is relevant and must run. Non-empty array of path prefixes, e.g. ["Sources", "Tests"]',
164
199
  is_string: false,
165
200
  verify_block: proc do |array|
166
201
  UI.user_error!("Sources have to be specified") unless array.kind_of?(Array) && array.size.positive?
@@ -169,53 +204,76 @@ module Fastlane
169
204
  FastlaneCore::ConfigItem.new(
170
205
  env_name: 'GITHUB_PR_NUM',
171
206
  key: :github_pr_num,
172
- description: 'GitHub PR number',
207
+ description: 'Pull request number to analyze. When empty or nil (e.g. not running for a PR), the ' \
208
+ 'action always returns true',
173
209
  optional: true
174
210
  ),
175
211
  FastlaneCore::ConfigItem.new(
176
212
  key: :required_checks,
177
- description: 'Names of GitHub check runs that must have concluded as success on the last commit ' \
178
- 'that changed :sources for the check to be skipped when the current push does not ' \
179
- 'touch :sources. When empty, the check is skipped as soon as the current push does ' \
180
- 'not touch :sources',
213
+ description: 'GitHub check-run names (exactly as shown on the PR, e.g. "Test (iOS 17)") that must ' \
214
+ 'have concluded as success to prove the current sources were already verified. Only ' \
215
+ 'consulted when the current push does not touch :sources: the check is skipped only if ' \
216
+ 'all of these passed on a commit that has the current source tree. When empty, a push ' \
217
+ 'that does not touch :sources is skipped immediately, without any verification',
181
218
  is_string: false,
182
219
  optional: true,
183
220
  default_value: []
184
221
  ),
185
222
  FastlaneCore::ConfigItem.new(
186
223
  key: :force_check,
187
- description: 'GitHub PR number',
224
+ description: 'When truthy, bypass all analysis and always return true (force the check to run)',
188
225
  optional: true,
189
226
  is_string: false
190
227
  ),
191
228
  FastlaneCore::ConfigItem.new(
192
229
  env_name: 'GITHUB_EVENT_ACTION',
193
230
  key: :github_event_action,
194
- description: 'pull_request action: e.g. opened, synchronize. When synchronize and before/after ' \
195
- 'are set, only files in that push are considered',
231
+ description: 'The pull_request event action, e.g. "opened" or "synchronize". When "synchronize" and ' \
232
+ 'github_event_before/after are set, only the files in that push are considered; ' \
233
+ 'otherwise the full PR diff is used',
196
234
  optional: true
197
235
  ),
198
236
  FastlaneCore::ConfigItem.new(
199
237
  env_name: 'GITHUB_EVENT_BEFORE',
200
238
  key: :github_event_before,
201
- description: 'github.event.before (head ref before the push) for pull_request',
239
+ description: 'github.event.before: the branch head SHA before the push. Combined with ' \
240
+ 'github_event_after to scope the diff to a single push on synchronize',
202
241
  optional: true
203
242
  ),
204
243
  FastlaneCore::ConfigItem.new(
205
244
  env_name: 'GITHUB_EVENT_AFTER',
206
245
  key: :github_event_after,
207
- description: 'github.event.after (head ref after the push) for pull_request',
246
+ description: 'github.event.after: the branch head SHA after the push. Combined with ' \
247
+ 'github_event_before to scope the diff to a single push on synchronize',
208
248
  optional: true
209
249
  ),
210
250
  FastlaneCore::ConfigItem.new(
211
251
  env_name: 'GITHUB_REPOSITORY',
212
252
  key: :github_repository,
213
- description: 'owner/repo; required for push-scoped file list (defaults to GITHUB_REPOSITORY in CI)',
253
+ description: 'Repository in "owner/repo" form. Needed to scope the diff to a push and to look up ' \
254
+ 'commit history and check runs. Defaults to the GITHUB_REPOSITORY env var set in CI',
214
255
  optional: true
215
256
  )
216
257
  ]
217
258
  end
218
259
 
260
+ def self.example_code
261
+ [
262
+ 'next unless is_check_required(sources: ["Sources", "Tests"])',
263
+ 'unless is_check_required(
264
+ sources: ["Sources"],
265
+ github_pr_num: ENV["GITHUB_PR_NUM"],
266
+ required_checks: ["Test (iOS 17)", "Build"]
267
+ )
268
+ next
269
+ end'
270
+ ]
271
+ end
272
+
273
+ def self.category
274
+ :testing
275
+ end
276
+
219
277
  def self.is_supported?(platform)
220
278
  true
221
279
  end
@@ -25,7 +25,11 @@ module Fastlane
25
25
  end
26
26
 
27
27
  sim.reset if sim && params[:reset]
28
- sh("xcrun simctl bootstatus #{udid} -b")
28
+ if params[:wait_for_boot]
29
+ sh("xcrun simctl bootstatus #{udid} -b")
30
+ else
31
+ sh("xcrun simctl boot #{udid} || true")
32
+ end
29
33
  UI.success("Simulator #{device_name} #{ios_version_with_brackets} is ready")
30
34
  udid
31
35
  end
@@ -50,6 +54,13 @@ module Fastlane
50
54
  description: 'Reset simulator contents',
51
55
  optional: true,
52
56
  is_string: false
57
+ ),
58
+ FastlaneCore::ConfigItem.new(
59
+ key: :wait_for_boot,
60
+ description: 'Wait for simulator to finish booting',
61
+ optional: true,
62
+ default_value: true,
63
+ is_string: false
53
64
  )
54
65
  ]
55
66
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.4'
3
+ VERSION = '0.4.6'
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.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-30 00:00:00.000000000 Z
11
+ date: 2026-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list