knapsack 1.17.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b304c2133621edb626e13c8eb63348ff35cd44b92cdd9c6feb8907d7b167691f
4
- data.tar.gz: 2f93fcb36498545ae550e502743423151cd53e8b2de22c4e10453c4e969d5344
3
+ metadata.gz: 8879f5cca688a2b1aa08c37eba20408ae00387137cb9ba141c144189dac4a75b
4
+ data.tar.gz: 4a4cb1f940dd7873d4187d5b1cae1261ca3c849566457d702aa94d9f754908c5
5
5
  SHA512:
6
- metadata.gz: 60b7447ae44842d5dfd70bb852a309a75a0fe654e81e9e6219a6b898354bb52f4497c5f2113801c9c7a9cc235f73c2ba3ea6c7cbf4123ac859a6ae08035ef170
7
- data.tar.gz: a0f7b743c29f1d61e08dbc1bc92301b5a89abd8baad129c34684142652b82b954272530642401da3d35aba4c44831076bbccbbdb71f61d007b2e1df9824642fb
6
+ metadata.gz: a9ab9066162444bd414c5cc9d45fbaf80ed91d438d1892064661362fffa60fdf2bcb09124e1a53883b5cd285c1f7c58c233dfb643dce0a2084168e2b2cdf7d8e
7
+ data.tar.gz: 67d6820b4c14a418761200069f158068ce74473b366b01d448f4eea5f98118fd8fa484a1f8fcc37480a43ea72c45cdcfb3689cf737e397dab24b77a421208a0d
@@ -2,13 +2,14 @@
2
2
  sudo: false
3
3
  language: ruby
4
4
  rvm:
5
- - 1.9.3
6
5
  - 2.0.0
7
6
  - 2.1
8
7
  - 2.2
9
8
  - 2.3
10
9
  - 2.4
11
10
  - 2.5
11
+ - 2.6
12
+ - 2.7
12
13
  addons:
13
14
  code_climate:
14
15
  repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
@@ -2,6 +2,49 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.20.0
6
+
7
+ * Use `Process.clock_gettime` to measure track execution time
8
+
9
+ https://github.com/ArturT/knapsack/pull/100
10
+
11
+ https://github.com/ArturT/knapsack/compare/v1.19.0...v1.20.0
12
+
13
+ ### 1.19.0
14
+
15
+ * Add support for Bitbucket Pipelines
16
+
17
+ https://github.com/ArturT/knapsack/pull/97
18
+
19
+ https://github.com/ArturT/knapsack/compare/v1.18.0...v1.19.0
20
+
21
+ ### 1.18.0
22
+
23
+ * Add support for Semaphore 2.0
24
+
25
+ https://github.com/ArturT/knapsack/pull/92
26
+
27
+ https://github.com/ArturT/knapsack/compare/v1.17.2...v1.18.0
28
+
29
+ ### 1.17.2
30
+
31
+ * Allow for new `bundler` in development
32
+ * Test Ruby 2.6 on CI
33
+ * Add info about Knapsack Pro Queue Mode in knapsack output
34
+ * Update URL to FAQ in knapsack output
35
+
36
+ https://github.com/ArturT/knapsack/pull/90
37
+
38
+ https://github.com/ArturT/knapsack/compare/v1.17.1...v1.17.2
39
+
40
+ ### 1.17.1
41
+
42
+ * Fix RSpec signal handling by replacing process
43
+
44
+ https://github.com/ArturT/knapsack/pull/86
45
+
46
+ https://github.com/ArturT/knapsack/compare/v1.17.0...v1.17.1
47
+
5
48
  ### 1.17.0
6
49
 
7
50
  * Add support for GitLab CI ENV variable `CI_NODE_INDEX` starting from 1.
data/README.md CHANGED
@@ -1 +1,36 @@
1
- # [Open README](http://docs.knapsackpro.com/ruby/knapsack)
1
+ # knapsack gem
2
+
3
+ Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time.
4
+
5
+ | | knapsack gem | knapsack_pro gem |
6
+ | -------------------------------------------- | ------------ | ---------------- |
7
+ | __Is free__ | ✓ Yes | ✓ Yes, [free plan](https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=free_plan) |
8
+ | __Regular Mode - a static tests split__ | ✓ Yes | ✓ Yes |
9
+ | __Queue Mode - a dynamic tests split__ <br>([ensures all CI nodes finish work at the same time](https://docs.knapsackpro.com/2020/how-to-speed-up-ruby-and-javascript-tests-with-ci-parallelisation)) | No | ✓ Yes |
10
+ | __Auto [split slow RSpec test file](https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it) between parallel CI nodes__ <br>(a single test file can be auto split by test examples between parallel jobs) | No | ✓ Yes |
11
+ | Tracking tests timing per commit, branch | No | ✓ Yes |
12
+ | Support for other programming languages | No | ✓ Yes |
13
+ | Support for CI providers | limited | ✓ Yes |
14
+ | __Installation README__ | [Install README](http://docs.knapsackpro.com/ruby/knapsack) | [Install README](https://docs.knapsackpro.com/integration/) |
15
+
16
+ [Features of knapsack vs knapsack_pro Ruby gem](https://knapsackpro.com/features/ruby_knapsack_pro_vs_knapsack?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=ruby_knapsack_pro_vs_knapsack)
17
+
18
+ # Do you use Heroku?
19
+
20
+ Do you know Knapsack Pro Ruby gem is available as Heroku add-on that's currently in beta and it's free to all beta users? It works with your current CI server.
21
+ https://elements.heroku.com/addons/knapsack-pro
22
+
23
+ Knapsack Pro has Queue Mode that will split Ruby & JS tests in a dynamic way across parallel CI nodes to ensure each parallel job takes a similar time. Thanks to that there is no bottleneck in your CI pipelines.
24
+
25
+ __See introduction how the Knapsack Pro add-on works__
26
+ https://youtu.be/rmXES2N0_QU
27
+
28
+ You may also find useful article how to run parallel dynos on Heroku CI to complete tests faster
29
+ https://docs.knapsackpro.com/2019/how-to-run-tests-faster-on-heroku-ci-with-parallel-dynos
30
+
31
+ ## Do you know
32
+
33
+ * Knapsack Pro is risk-free integration! Knapsack Pro runs tests in Fallback Mode if your CI servers can't reach our API for any reason.
34
+ * We don't need access to your repository. Knapsack Pro is just wrapper around test runner like RSpec, Cucumber, Minitest etc.
35
+ * Hundreds of developers use Knapsack Pro every day to run fast CI builds.
36
+ * It works with other programming languages.
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'rake', '>= 0'
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.6'
25
+ spec.add_development_dependency 'bundler', '>= 1.6'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0', '>= 2.10.0'
27
27
  spec.add_development_dependency 'rspec-its', '~> 1.2'
28
28
  spec.add_development_dependency 'cucumber', '>= 0'
@@ -7,11 +7,11 @@ module Knapsack
7
7
  end
8
8
 
9
9
  def ci_node_total
10
- ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_THREAD_COUNT'] || ENV['BUILDKITE_PARALLEL_JOB_COUNT'] || ENV['SNAP_WORKER_TOTAL'] || 1
10
+ ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_JOB_COUNT'] || ENV['SEMAPHORE_THREAD_COUNT'] || ENV['BUILDKITE_PARALLEL_JOB_COUNT'] || ENV['SNAP_WORKER_TOTAL'] || ENV['BITBUCKET_PARALLEL_STEP_COUNT'] || 1
11
11
  end
12
12
 
13
13
  def ci_node_index
14
- gitlab_ci_node_index || ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_current_thread || ENV['BUILDKITE_PARALLEL_JOB'] || snap_ci_worker_index || 0
14
+ gitlab_ci_node_index || ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_job_index || semaphore_current_thread || ENV['BUILDKITE_PARALLEL_JOB'] || snap_ci_worker_index || ENV['BITBUCKET_PARALLEL_STEP'] || 0
15
15
  end
16
16
 
17
17
  def test_file_pattern
@@ -36,6 +36,10 @@ module Knapsack
36
36
  index.to_i - 1 if index
37
37
  end
38
38
 
39
+ def semaphore_job_index
40
+ index_starting_from_one(ENV['SEMAPHORE_JOB_INDEX'])
41
+ end
42
+
39
43
  def semaphore_current_thread
40
44
  index_starting_from_one(ENV['SEMAPHORE_CURRENT_THREAD'])
41
45
  end
@@ -61,9 +61,13 @@ Global time execution for this CI node is fine.
61
61
  Happy testing!}
62
62
  end
63
63
  str << "\n\nNeed explanation? See FAQ:"
64
- str << "\nhttps://github.com/ArturT/knapsack#faq"
64
+ str << "\nhttps://docs.knapsackpro.com/ruby/knapsack#faq"
65
65
  str << "\n=================================================\n"
66
- str << %{Sign up for Knapsack Pro here:
66
+ str << %{See how to split tests in a dynamic way using Queue Mode to ensure all parallel nodes
67
+ finish work at a similar time even when your CI or random test execution is a bottleneck:
68
+ https://youtu.be/hUEB1XDKEFY
69
+
70
+ Sign up for Knapsack Pro here:
67
71
  https://knapsackpro.com}
68
72
  str << "\n=================================================\n"
69
73
  str
@@ -14,8 +14,7 @@ module Knapsack
14
14
 
15
15
  cmd = %Q[bundle exec rspec #{args} --default-path #{allocator.test_dir} -- #{allocator.stringify_node_tests}]
16
16
 
17
- system(cmd)
18
- exit($?.exitstatus) unless $?.exitstatus == 0
17
+ exec(cmd)
19
18
  end
20
19
  end
21
20
  end
@@ -81,11 +81,7 @@ module Knapsack
81
81
  end
82
82
 
83
83
  def now_without_mock_time
84
- if defined?(Timecop)
85
- Time.now_without_mock_time
86
- else
87
- Time.raw_now
88
- end
84
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
89
85
  end
90
86
  end
91
87
  end
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.17.0'
2
+ VERSION = '1.20.0'
3
3
  end
@@ -27,6 +27,11 @@ describe Knapsack::Config::Env do
27
27
  it { should eql 4 }
28
28
  end
29
29
 
30
+ context 'when SEMAPHORE_JOB_COUNT has value' do
31
+ before { stub_const("ENV", { 'SEMAPHORE_JOB_COUNT' => 3 }) }
32
+ it { should eql 3 }
33
+ end
34
+
30
35
  context 'when SEMAPHORE_THREAD_COUNT has value' do
31
36
  before { stub_const("ENV", { 'SEMAPHORE_THREAD_COUNT' => 3 }) }
32
37
  it { should eql 3 }
@@ -41,6 +46,11 @@ describe Knapsack::Config::Env do
41
46
  before { stub_const("ENV", { 'SNAP_WORKER_TOTAL' => 6 }) }
42
47
  it { should eql 6 }
43
48
  end
49
+
50
+ context 'when BITBUCKET_PARALLEL_STEP_COUNT has value' do
51
+ before { stub_const("ENV", { 'BITBUCKET_PARALLEL_STEP_COUNT' => 8 }) }
52
+ it { should eql 8 }
53
+ end
44
54
  end
45
55
 
46
56
  context "when ENV doesn't exist" do
@@ -67,6 +77,11 @@ describe Knapsack::Config::Env do
67
77
  it { should eql 2 }
68
78
  end
69
79
 
80
+ context 'when SEMAPHORE_JOB_INDEX has value' do
81
+ before { stub_const("ENV", { 'SEMAPHORE_JOB_INDEX' => 3 }) }
82
+ it { should eql 2 }
83
+ end
84
+
70
85
  context 'when SEMAPHORE_CURRENT_THREAD has value' do
71
86
  before { stub_const("ENV", { 'SEMAPHORE_CURRENT_THREAD' => 1 }) }
72
87
  it { should eql 0 }
@@ -81,6 +96,11 @@ describe Knapsack::Config::Env do
81
96
  before { stub_const("ENV", { 'SNAP_WORKER_INDEX' => 4 }) }
82
97
  it { should eql 3 }
83
98
  end
99
+
100
+ context 'when BITBUCKET_PARALLEL_STEP has value' do
101
+ before { stub_const("ENV", { 'BITBUCKET_PARALLEL_STEP' => 7 }) }
102
+ it { should eql 7 }
103
+ end
84
104
  end
85
105
 
86
106
  context "when ENV doesn't exist" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2020-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -28,36 +28,36 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
45
  - - ">="
49
46
  - !ruby/object:Gem::Version
50
47
  version: 2.10.0
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: '3.0'
58
55
  - - ">="
59
56
  - !ruby/object:Gem::Version
60
57
  version: 2.10.0
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec-its
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -285,8 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
285
  - !ruby/object:Gem::Version
286
286
  version: '0'
287
287
  requirements: []
288
- rubyforge_project:
289
- rubygems_version: 2.7.6
288
+ rubygems_version: 3.0.6
290
289
  signing_key:
291
290
  specification_version: 4
292
291
  summary: Knapsack splits tests across CI nodes and makes sure that tests will run