knapsack_pro 3.8.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +377 -23
  3. data/.github/dependabot.yml +11 -0
  4. data/.github/pull_request_template.md +22 -0
  5. data/.gitignore +4 -0
  6. data/CHANGELOG.md +325 -1
  7. data/Gemfile +9 -0
  8. data/README.md +3 -10
  9. data/bin/test +15 -0
  10. data/knapsack_pro.gemspec +7 -6
  11. data/lib/knapsack_pro/adapters/base_adapter.rb +17 -2
  12. data/lib/knapsack_pro/adapters/cucumber_adapter.rb +3 -3
  13. data/lib/knapsack_pro/adapters/minitest_adapter.rb +2 -0
  14. data/lib/knapsack_pro/adapters/rspec_adapter.rb +88 -49
  15. data/lib/knapsack_pro/adapters/spinach_adapter.rb +2 -0
  16. data/lib/knapsack_pro/adapters/test_unit_adapter.rb +2 -0
  17. data/lib/knapsack_pro/allocator.rb +2 -0
  18. data/lib/knapsack_pro/allocator_builder.rb +2 -0
  19. data/lib/knapsack_pro/base_allocator_builder.rb +8 -25
  20. data/lib/knapsack_pro/build_distribution_fetcher.rb +2 -0
  21. data/lib/knapsack_pro/client/api/action.rb +2 -0
  22. data/lib/knapsack_pro/client/api/v1/base.rb +2 -0
  23. data/lib/knapsack_pro/client/api/v1/build_distributions.rb +5 -0
  24. data/lib/knapsack_pro/client/api/v1/build_subsets.rb +2 -0
  25. data/lib/knapsack_pro/client/api/v1/queues.rb +6 -1
  26. data/lib/knapsack_pro/client/connection.rb +5 -6
  27. data/lib/knapsack_pro/config/ci/app_veyor.rb +18 -0
  28. data/lib/knapsack_pro/config/ci/base.rb +27 -0
  29. data/lib/knapsack_pro/config/ci/buildkite.rb +18 -0
  30. data/lib/knapsack_pro/config/ci/circle.rb +18 -0
  31. data/lib/knapsack_pro/config/ci/cirrus_ci.rb +18 -0
  32. data/lib/knapsack_pro/config/ci/codefresh.rb +18 -0
  33. data/lib/knapsack_pro/config/ci/codeship.rb +18 -0
  34. data/lib/knapsack_pro/config/ci/github_actions.rb +26 -0
  35. data/lib/knapsack_pro/config/ci/gitlab_ci.rb +20 -1
  36. data/lib/knapsack_pro/config/ci/heroku.rb +18 -0
  37. data/lib/knapsack_pro/config/ci/semaphore.rb +16 -0
  38. data/lib/knapsack_pro/config/ci/semaphore2.rb +19 -0
  39. data/lib/knapsack_pro/config/ci/travis.rb +18 -0
  40. data/lib/knapsack_pro/config/env.rb +46 -22
  41. data/lib/knapsack_pro/config/env_generator.rb +2 -0
  42. data/lib/knapsack_pro/config/temp_files.rb +8 -4
  43. data/lib/knapsack_pro/crypto/branch_encryptor.rb +2 -0
  44. data/lib/knapsack_pro/crypto/decryptor.rb +2 -0
  45. data/lib/knapsack_pro/crypto/digestor.rb +2 -0
  46. data/lib/knapsack_pro/crypto/encryptor.rb +2 -0
  47. data/lib/knapsack_pro/extensions/rspec_extension.rb +137 -0
  48. data/lib/knapsack_pro/formatters/rspec_json_formatter.rb +2 -0
  49. data/lib/knapsack_pro/formatters/time_tracker.rb +152 -0
  50. data/lib/knapsack_pro/formatters/time_tracker_fetcher.rb +20 -0
  51. data/lib/knapsack_pro/hooks/queue.rb +2 -0
  52. data/lib/knapsack_pro/logger_wrapper.rb +2 -0
  53. data/lib/knapsack_pro/mask_string.rb +9 -0
  54. data/lib/knapsack_pro/presenter.rb +6 -3
  55. data/lib/knapsack_pro/pure/queue/rspec_pure.rb +92 -0
  56. data/lib/knapsack_pro/queue_allocator.rb +2 -0
  57. data/lib/knapsack_pro/queue_allocator_builder.rb +2 -0
  58. data/lib/knapsack_pro/railtie.rb +2 -0
  59. data/lib/knapsack_pro/report.rb +15 -9
  60. data/lib/knapsack_pro/repository_adapter_initiator.rb +2 -0
  61. data/lib/knapsack_pro/repository_adapters/base_adapter.rb +2 -0
  62. data/lib/knapsack_pro/repository_adapters/env_adapter.rb +2 -0
  63. data/lib/knapsack_pro/repository_adapters/git_adapter.rb +50 -0
  64. data/lib/knapsack_pro/runners/base_runner.rb +2 -0
  65. data/lib/knapsack_pro/runners/cucumber_runner.rb +2 -0
  66. data/lib/knapsack_pro/runners/minitest_runner.rb +2 -0
  67. data/lib/knapsack_pro/runners/queue/base_runner.rb +29 -0
  68. data/lib/knapsack_pro/runners/queue/cucumber_runner.rb +9 -6
  69. data/lib/knapsack_pro/runners/queue/minitest_runner.rb +13 -6
  70. data/lib/knapsack_pro/runners/queue/rspec_runner.rb +128 -135
  71. data/lib/knapsack_pro/runners/rspec_runner.rb +22 -3
  72. data/lib/knapsack_pro/runners/spinach_runner.rb +2 -0
  73. data/lib/knapsack_pro/runners/test_unit_runner.rb +2 -0
  74. data/lib/knapsack_pro/slow_test_file_determiner.rb +2 -0
  75. data/lib/knapsack_pro/slow_test_file_finder.rb +2 -0
  76. data/lib/knapsack_pro/task_loader.rb +2 -0
  77. data/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb +2 -0
  78. data/lib/knapsack_pro/test_case_mergers/base_merger.rb +2 -0
  79. data/lib/knapsack_pro/test_case_mergers/rspec_merger.rb +2 -0
  80. data/lib/knapsack_pro/test_file_cleaner.rb +2 -0
  81. data/lib/knapsack_pro/test_file_finder.rb +2 -0
  82. data/lib/knapsack_pro/test_file_pattern.rb +2 -0
  83. data/lib/knapsack_pro/test_file_presenter.rb +2 -0
  84. data/lib/knapsack_pro/test_files_with_test_cases_composer.rb +2 -0
  85. data/lib/knapsack_pro/test_flat_distributor.rb +2 -0
  86. data/lib/knapsack_pro/tracker.rb +3 -3
  87. data/lib/knapsack_pro/urls.rb +4 -0
  88. data/lib/knapsack_pro/utils.rb +2 -0
  89. data/lib/knapsack_pro/version.rb +3 -1
  90. data/lib/knapsack_pro.rb +5 -3
  91. data/lib/tasks/cucumber.rake +2 -0
  92. data/lib/tasks/encrypted_branch_names.rake +2 -0
  93. data/lib/tasks/encrypted_test_file_names.rake +2 -0
  94. data/lib/tasks/minitest.rake +2 -0
  95. data/lib/tasks/queue/cucumber.rake +13 -0
  96. data/lib/tasks/queue/minitest.rake +13 -0
  97. data/lib/tasks/queue/rspec.rake +13 -0
  98. data/lib/tasks/rspec.rake +5 -0
  99. data/lib/tasks/salt.rake +2 -0
  100. data/lib/tasks/spinach.rake +2 -0
  101. data/lib/tasks/test_unit.rake +2 -0
  102. data/spec/integration/api/build_distributions_subset_spec.rb +1 -0
  103. data/spec/integration/runners/queue/rspec_runner.rb +80 -0
  104. data/spec/integration/runners/queue/rspec_runner_spec.rb +2232 -0
  105. data/spec/knapsack_pro/adapters/base_adapter_spec.rb +30 -11
  106. data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +2 -5
  107. data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +146 -174
  108. data/spec/knapsack_pro/base_allocator_builder_spec.rb +22 -48
  109. data/spec/knapsack_pro/client/api/v1/build_distributions_spec.rb +19 -27
  110. data/spec/knapsack_pro/client/api/v1/queues_spec.rb +23 -43
  111. data/spec/knapsack_pro/client/connection_spec.rb +59 -7
  112. data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +22 -8
  113. data/spec/knapsack_pro/config/ci/base_spec.rb +1 -0
  114. data/spec/knapsack_pro/config/ci/buildkite_spec.rb +51 -16
  115. data/spec/knapsack_pro/config/ci/circle_spec.rb +48 -13
  116. data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +12 -12
  117. data/spec/knapsack_pro/config/ci/codefresh_spec.rb +21 -6
  118. data/spec/knapsack_pro/config/ci/codeship_spec.rb +20 -6
  119. data/spec/knapsack_pro/config/ci/github_actions_spec.rb +37 -10
  120. data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +48 -13
  121. data/spec/knapsack_pro/config/ci/heroku_spec.rb +12 -12
  122. data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +11 -11
  123. data/spec/knapsack_pro/config/ci/semaphore_spec.rb +12 -12
  124. data/spec/knapsack_pro/config/ci/travis_spec.rb +8 -8
  125. data/spec/knapsack_pro/config/env_spec.rb +204 -124
  126. data/spec/knapsack_pro/formatters/time_tracker_specs.rb +424 -0
  127. data/spec/knapsack_pro/hooks/queue_spec.rb +2 -2
  128. data/spec/knapsack_pro/presenter_spec.rb +1 -1
  129. data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +224 -0
  130. data/spec/knapsack_pro/repository_adapters/git_adapter_spec.rb +72 -0
  131. data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +18 -16
  132. data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +17 -14
  133. data/spec/knapsack_pro/runners/rspec_runner_spec.rb +40 -23
  134. data/spec/knapsack_pro/test_case_detectors/rspec_test_example_detector_spec.rb +1 -0
  135. data/spec/knapsack_pro/tracker_spec.rb +0 -4
  136. data/spec/knapsack_pro_spec.rb +3 -3
  137. data/spec/spec_helper.rb +0 -1
  138. metadata +26 -23
  139. data/lib/knapsack_pro/config/ci/snap_ci.rb +0 -35
  140. data/lib/knapsack_pro/config/ci/solano_ci.rb +0 -32
  141. data/lib/knapsack_pro/extensions/time.rb +0 -7
  142. data/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb +0 -56
  143. data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +0 -112
  144. data/spec/knapsack_pro/config/ci/snap_ci_spec.rb +0 -104
  145. data/spec/knapsack_pro/config/ci/solano_ci_spec.rb +0 -73
  146. data/spec/knapsack_pro/extensions/time_spec.rb +0 -5
  147. data/spec/knapsack_pro/runners/queue/rspec_runner_spec.rb +0 -342
data/CHANGELOG.md CHANGED
@@ -1,4 +1,328 @@
1
- # Change Log
1
+ # Changelog
2
+
3
+ ### 7.0.0
4
+
5
+ * __(breaking change)__ RSpec in Queue Mode:
6
+ * The default for `KNAPSACK_PRO_LOG_LEVEL` is `info` instead of `debug`.
7
+ * The RSpec `before(:suite)` and `after(:suite)` hooks changed:
8
+
9
+ __Before:__<br>
10
+ The `before(:suite)` and `after(:suite)` hooks were executed multiple times. Each time for a batch of tests fetched from Knapsack Pro Queue API.
11
+
12
+ __After:__<br>
13
+ The `before(:suite)` and `after(:suite)` hooks are executed only once: `before(:suite)` is executed before starting tests, `after(:suite)` is executed after all tests are completed. (It is what you would expect from RSpec).
14
+
15
+ * The `KnapsackPro::Hooks::Queue.after_queue` hook change:
16
+
17
+ __Before:__<br>
18
+ The `KnapsackPro::Hooks::Queue.after_queue` hook is executed outside of the `after(:suite)` hook.
19
+
20
+ __After:__<br>
21
+ The `KnapsackPro::Hooks::Queue.after_queue` hook is executed __inside__ of the `after(:suite)` hook.
22
+
23
+ * Recommended RSpec changes in your project:
24
+ * Remove the following code if you use Queue Mode and the `rspec_junit_formatter` gem to generate JUnit XML or JSON reports:
25
+
26
+ ```ruby
27
+ # REMOVE THE FOLLOWING CODE
28
+
29
+ # spec_helper.rb or rails_helper.rb
30
+ TMP_REPORT = "tmp/rspec_#{ENV['KNAPSACK_PRO_CI_NODE_INDEX']}.xml"
31
+ FINAL_REPORT = "tmp/final_rspec_#{ENV['KNAPSACK_PRO_CI_NODE_INDEX']}.xml"
32
+
33
+ KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
34
+ if File.exist?(TMP_REPORT)
35
+ FileUtils.mv(TMP_REPORT, FINAL_REPORT)
36
+ end
37
+ end
38
+ ```
39
+
40
+ Learn more about [using Knapsack Pro with RSpec formatters](https://docs.knapsackpro.com/ruby/rspec/#formatters-rspec_junit_formatter-json) and [using Knapsack Pro with CircleCI](https://docs.knapsackpro.com/ruby/circleci/) in the docs.
41
+
42
+ * Replace the following code if you are using Queue Mode and the `percy-capybara` gem on a version older than 4:
43
+
44
+ Before:
45
+
46
+ ```ruby
47
+ KnapsackPro::Hooks::Queue.before_queue { |queue_id| Percy::Capybara.initialize_build }
48
+ KnapsackPro::Hooks::Queue.after_queue { |queue_id| Percy::Capybara.finalize_build }
49
+ ```
50
+
51
+ After:
52
+
53
+ ```ruby
54
+ # recommended
55
+ before(:suite) { Percy::Capybara.initialize_build }
56
+ after(:suite) { Percy::Capybara.finalize_build }
57
+ ```
58
+
59
+ Learn more about [using Knapsack Pro with Percy](https://docs.knapsackpro.com/ruby/hooks/#percy-capybara) in the docs.
60
+
61
+ * We are no longer modifying the default RSpec formatters in Queue Mode. You can remove the [`KNAPSACK_PRO_MODIFY_DEFAULT_RSPEC_FORMATTERS`](https://docs.knapsackpro.com/ruby/reference/#knapsack_pro_modify_default_rspec_formatters-removed-rspec) environment variable from your CI config if you are using it.
62
+
63
+ * RSpec improvements in Queue Mode:
64
+ * Termination signals (`HUP`, `INT`, `TERM`, `ABRT`, `QUIT`, `USR1`, and `USR2`) are handled earlier: the process will terminate before the next top-level example group (`describe` or `context`) instead of waiting for the next Knapsack Pro batch of tests.
65
+
66
+ * Respect the `--error-exit-code` option. It sets a custom exit code (instead of `1`) when RSpec fails outside an example (e.g. lack of memory, termination signal).
67
+
68
+ ```bash
69
+ bundle exec rake "knapsack_pro:queue:rspec[--error-exit-code 3]"
70
+ ```
71
+
72
+ * Respect the `--failure-exit-code` option. It sets a custom exit code for when any examples fail.
73
+
74
+ ```bash
75
+ bundle exec rake "knapsack_pro:queue:rspec[--failure-exit-code 2]"
76
+ ```
77
+
78
+ * Respect the `--fail-fast` option and show a warning in the Knapsack Pro log.
79
+
80
+ * Ignore the `fail_if_no_examples` option in Queue Mode:
81
+ * A late CI node, started after all tests were executed by other nodes, is expected to receive an empty batch.
82
+ * A batch could contain tests with no examples (e.g. commented out)
83
+
84
+ * Raise an exception if the [deprecated `run_all_when_everything_filtered`](https://docs.knapsackpro.com/ruby/rspec/#some-of-my-test-files-are-not-executed) option is detected.
85
+
86
+ PR with the above changes: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/237
87
+
88
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.4...v7.0.0
89
+
90
+ ### 6.0.4
91
+
92
+ * fix(minitest): avoid installing `at_exit` (that would result in an empty run of Minitest after Knapsack Pro is finished in Queue Mode)
93
+
94
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/236
95
+
96
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.3...v6.0.4
97
+
98
+ ### 6.0.3
99
+
100
+ * fix(Turnip): make sure `.feature` files are recorded
101
+ * fix(RSpec): stop recording `UNKNOWN_PATH` that would generate an error in case of a CI node retry
102
+
103
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/233
104
+
105
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.2...v6.0.3
106
+
107
+ ### 6.0.2
108
+
109
+ * fix(RSpec): allow using `TimeTracker` in RSpec < 3.10.2 when formatters were required to expose `#output`
110
+
111
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/232
112
+
113
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.1...v6.0.2
114
+
115
+ ### 6.0.1
116
+
117
+ * fix(RSpec): allow using Queue Mode in RSpec <= 3.10 when the `rspec_is_quitting` method is not present for RSpec World object
118
+
119
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/231
120
+
121
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.0...v6.0.1
122
+
123
+ ### 6.0.0
124
+
125
+ * __(breaking change)__ Dropped support for Turnip < 2.0.0
126
+ * Use an RSpec Formatter to track tests' execution times more accurately
127
+ * Removed `Time.raw_now`
128
+
129
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/229
130
+
131
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.7.0...v6.0.0
132
+
133
+ ### 5.7.0
134
+
135
+ * Performance improvement: don't run `rake knapsack_pro:rspec_test_example_detector` when no slow test files are detected for RSpec.
136
+
137
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/225
138
+
139
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.6.0...v5.7.0
140
+
141
+ ### 5.6.0
142
+
143
+ * Use `frozen_string_literal: true` to reduce memory usage
144
+
145
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/220
146
+
147
+ * Enforce `frozen_string_literal: true` in the gem files with Rubocop
148
+
149
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/222
150
+
151
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.5.0...v5.6.0
152
+
153
+ ### 5.5.0
154
+
155
+ * Detect user seats for AppVeyor, Codefresh, Codeship
156
+
157
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/221
158
+
159
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.4.1...v5.5.0
160
+
161
+ ### 5.4.1
162
+
163
+ * Fixes RSpec conflict (see https://github.com/KnapsackPro/knapsack_pro-ruby/issues/217)
164
+
165
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/218
166
+
167
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.4.0...v5.4.1
168
+
169
+ ### 5.4.0
170
+
171
+ * Send to the API the CI provider with a header
172
+
173
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/216
174
+
175
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.5...v5.4.0
176
+
177
+ ### 5.3.5
178
+
179
+ * Handle RSpec exceptions when running RSpec in Queue Mode
180
+
181
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/214
182
+
183
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/215
184
+
185
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.4...v5.3.5
186
+
187
+ ### 5.3.4
188
+
189
+ * fix(Queue Mode): handle OS signals and RSpec internal `wants_to_quit` and `rspec_is_quitting` states to stop consuming tests from the Queue API when the CI node is terminated
190
+
191
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/207
192
+
193
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.3...v5.3.4
194
+
195
+ ### 5.3.3
196
+
197
+ * Fix hanging CI when `git fetch --shallow-since` takes too long
198
+
199
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/213
200
+
201
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.2...v5.3.3
202
+
203
+ ### 5.3.2
204
+
205
+ * On top of 5.3.1, avoid noise to stderr when git is not available when collecting the build author
206
+
207
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.1...v5.3.2
208
+
209
+ ### 5.3.1
210
+
211
+ * Avoid noise to stderr when git is not available when collecting authors
212
+
213
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/211
214
+
215
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.3.0...v5.3.1
216
+
217
+ ### 5.3.0
218
+
219
+ * Perf: Send authors to the API only on the first request (for Queue Mode)
220
+
221
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.2.1...v5.3.0
222
+
223
+ ### 5.2.1
224
+
225
+ * Shallow fetch the last month of commits only on CI
226
+ * Ensure input to `git shortlog`
227
+
228
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/209
229
+
230
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.2.0...v5.2.1
231
+
232
+ ### 5.2.0
233
+
234
+ * Send authors to the API
235
+
236
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/208
237
+
238
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.1.2...v5.2.0
239
+
240
+ ### 5.1.2
241
+
242
+ * Fix broken RSpec split by test examples feature when `SPEC_OPTS` is set in Queue Mode. Ignore `SPEC_OPTS` when generating test examples report for slow test files.
243
+
244
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/191
245
+
246
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.1.1...v5.1.2
247
+
248
+ ### 5.1.1
249
+
250
+ * Use `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` as default value in Queue Mode for GitLab CI
251
+
252
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/206
253
+
254
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.1.0...v5.1.1
255
+
256
+ ### 5.1.0
257
+
258
+ * Mask user seats data instead of hashing it
259
+
260
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/202
261
+
262
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.0.0...v5.1.0
263
+
264
+
265
+ ### 5.0.0
266
+
267
+ * __(breaking change)__ Use `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` as default value in Queue Mode and use `false` for proper CI providers
268
+
269
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/198
270
+
271
+ * Detect CI from environment and get the correct ENVs instead of trying all of them and risk conflicts
272
+
273
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/201
274
+
275
+ __(breaking change)__ for Buildkite. You need to pass the `BUILDKITE` environment variable to Docker Compose.
276
+
277
+ https://github.com/KnapsackPro/knapsack_pro-ruby/issues/204
278
+
279
+ * Set `RAILS_ENV=test` / `RACK_ENV=test` in Queue Mode
280
+
281
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/199
282
+
283
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v4.1.0...v5.0.0
284
+
285
+ ### 4.1.0
286
+
287
+ * Add support for CI node retry count on GitHub Actions
288
+
289
+ __(breaking change)__ for open-source forked repositories using GitHub Actions. See a fix in PR description:
290
+
291
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/197
292
+
293
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v4.0.0...v4.1.0
294
+
295
+ ### 4.0.0
296
+
297
+ * __(breaking change)__ Raise when `KNAPSACK_PRO_CI_NODE_BUILD_ID` is missing
298
+
299
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/195
300
+
301
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.11.0...v4.0.0
302
+
303
+ ### 3.11.0
304
+
305
+ * Send distinguishable user seat info over to the API
306
+
307
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/192
308
+
309
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.10.0...v3.11.0
310
+
311
+ ### 3.10.0
312
+
313
+ * Remove Solano CI and Snap CI support because they do not exist anymore
314
+
315
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/194
316
+
317
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.9.0...v3.10.0
318
+
319
+ ### 3.9.0
320
+
321
+ * Suppress all RSpec spec file names displayed in stdout at the beginning of running tests in Regular Mode only when the log level is >= `warn`
322
+
323
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/190
324
+
325
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.8.0...v3.9.0
2
326
 
3
327
  ### 3.8.0
4
328
 
data/Gemfile CHANGED
@@ -2,3 +2,12 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in knapsack.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'rspec_junit_formatter', require: false
8
+ gem 'nokogiri', require: false
9
+ gem 'simplecov', require: false
10
+
11
+ # This line is going to be replaced on CI to test different RSpec versions.
12
+ # gem 'rspec-core', 'x.x.x'
13
+ end
data/README.md CHANGED
@@ -18,9 +18,6 @@
18
18
  <a href="https://rubygems.org/gems/knapsack_pro">
19
19
  <img alt="Gem Version" src="https://badge.fury.io/rb/knapsack_pro.svg" />
20
20
  </a>
21
- <a href="https://codeclimate.com/github/KnapsackPro/knapsack_pro-ruby">
22
- <img alt="Code Climate" src="https://codeclimate.com/github/KnapsackPro/knapsack_pro-ruby/badges/gpa.svg" />
23
- </a>
24
21
  </div>
25
22
 
26
23
  <br />
@@ -45,16 +42,12 @@ The `knapsack_pro` gem supports all CIs and the following test runners:
45
42
  - Spinach
46
43
  - Turnip
47
44
 
48
- ## Requirements
49
-
50
- `>= Ruby 2.1.0`
51
-
52
45
  ## Installation
53
46
 
54
- The [Installation Guide](http://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide) will ask you a few questions and generate instruction steps for your project:
47
+ The [Installation Guide](https://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide) will ask you a few questions and generate instruction steps for your project:
55
48
 
56
49
  <div align="center">
57
- <a href="http://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide">
50
+ <a href="https://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide">
58
51
  <img alt="Install button" src="./.github/assets/install-button.png" width="116" height="50" />
59
52
  </a>
60
53
  </div>
@@ -74,7 +67,7 @@ bundle update knapsack_pro
74
67
  RSpec:
75
68
 
76
69
  ```bash
77
- bundle exec rspec spec
70
+ bin/test
78
71
  ```
79
72
 
80
73
  Scripted tests can be found in the [Rails App With Knapsack Pro repository](https://github.com/KnapsackPro/rails-app-with-knapsack_pro/blob/master/bin/knapsack_pro_all.rb).
data/bin/test ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ bundle exec ruby spec/knapsack_pro/formatters/time_tracker_specs.rb
4
+ FORMATTERS_EXIT_CODE=$?
5
+
6
+ bundle exec rspec spec
7
+ RSPEC_EXIT_CODE=$?
8
+
9
+ if [ "$FORMATTERS_EXIT_CODE" -ne "0" ]; then
10
+ exit $FORMATTERS_EXIT_CODE
11
+ fi
12
+
13
+ if [ "$RSPEC_EXIT_CODE" -ne "0" ]; then
14
+ exit $RSPEC_EXIT_CODE
15
+ fi
data/knapsack_pro.gemspec CHANGED
@@ -4,26 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'knapsack_pro/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "knapsack_pro"
7
+ spec.name = 'knapsack_pro'
8
8
  spec.version = KnapsackPro::VERSION
9
+ spec.required_ruby_version = '>= 2.7.0'
9
10
  spec.authors = ['ArturT']
10
- spec.email = ['arturtrzop@gmail.com']
11
+ spec.email = ['support@knapsackpro.com']
11
12
  spec.summary = %q{Knapsack Pro splits tests across parallel CI nodes and ensures each parallel job finish work at a similar time.}
12
- spec.description = %q{Run tests in parallel across CI server nodes based on tests execution time. Split tests in a dynamic way to ensure parallel jobs are done at a similar time. Thanks to that your CI build time is as fast as possible. It works with many CI providers.}
13
+ spec.description = %q{Knapsack Pro wraps your current test runner(s) and works with your existing CI infrastructure to parallelize tests optimally. It dynamically splits your tests based on up-to-date test execution data. It's designed from the ground up for CI and supports all of them.}
13
14
  spec.homepage = 'https://knapsackpro.com'
14
15
  spec.license = 'MIT'
15
16
  spec.metadata = {
16
17
  'bug_tracker_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby/issues',
17
18
  'changelog_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md',
18
- 'documentation_uri' => 'https://docs.knapsackpro.com/integration/',
19
+ 'documentation_uri' => 'https://docs.knapsackpro.com/knapsack_pro-ruby/guide/',
19
20
  'homepage_uri' => 'https://knapsackpro.com',
20
21
  'source_code_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby'
21
22
  }
22
23
 
23
24
  spec.files = `git ls-files -z`.split("\x0")
24
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
+ spec.executables = ['knapsack_pro']
25
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
- spec.require_paths = ["lib"]
27
+ spec.require_paths = ['lib']
27
28
 
28
29
  spec.add_dependency 'rake', '>= 0'
29
30
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Adapters
3
5
  class BaseAdapter
@@ -9,6 +11,14 @@ module KnapsackPro
9
11
  "#{KnapsackPro::Config::TempFiles::TEMP_DIRECTORY_PATH}/#{adapter_name}-bind_method_called_for_node_#{KnapsackPro::Config::Env.ci_node_index}.txt"
10
12
  end
11
13
 
14
+ def self.split_by_test_cases_enabled?
15
+ false
16
+ end
17
+
18
+ def self.test_file_cases_for(slow_test_files)
19
+ raise NotImplementedError
20
+ end
21
+
12
22
  def self.slow_test_file?(adapter_class, test_file_path)
13
23
  @slow_test_file_paths ||=
14
24
  begin
@@ -50,13 +60,13 @@ module KnapsackPro
50
60
  File.write(self.class.adapter_bind_method_called_file, nil)
51
61
 
52
62
  if KnapsackPro::Config::Env.recording_enabled?
53
- KnapsackPro.logger.debug('Test suite time execution recording enabled.')
63
+ KnapsackPro.logger.debug('Regular Mode enabled.')
54
64
  bind_time_tracker
55
65
  bind_save_report
56
66
  end
57
67
 
58
68
  if KnapsackPro::Config::Env.queue_recording_enabled?
59
- KnapsackPro.logger.debug('Test suite time execution queue recording enabled.')
69
+ KnapsackPro.logger.debug('Queue Mode enabled.')
60
70
  bind_queue_mode
61
71
  end
62
72
  end
@@ -73,8 +83,13 @@ module KnapsackPro
73
83
  raise NotImplementedError
74
84
  end
75
85
 
86
+ def bind_after_queue_hook
87
+ raise NotImplementedError
88
+ end
89
+
76
90
  def bind_queue_mode
77
91
  bind_before_queue_hook
92
+ bind_after_queue_hook
78
93
  bind_time_tracker
79
94
  end
80
95
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Adapters
3
5
  class CucumberAdapter < BaseAdapter
@@ -63,9 +65,7 @@ module KnapsackPro
63
65
  end
64
66
  end
65
67
 
66
- def bind_queue_mode
67
- super
68
-
68
+ def bind_after_queue_hook
69
69
  ::Kernel.at_exit do
70
70
  KnapsackPro::Hooks::Queue.call_after_subset_queue
71
71
  KnapsackPro::Report.save_subset_queue_to_file
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Adapters
3
5
  class MinitestAdapter < BaseAdapter