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 +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +43 -0
- data/README.md +36 -1
- data/knapsack.gemspec +1 -1
- data/lib/knapsack/config/env.rb +6 -2
- data/lib/knapsack/presenter.rb +6 -2
- data/lib/knapsack/runners/rspec_runner.rb +1 -2
- data/lib/knapsack/tracker.rb +1 -5
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/config/env_spec.rb +20 -0
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8879f5cca688a2b1aa08c37eba20408ae00387137cb9ba141c144189dac4a75b
|
4
|
+
data.tar.gz: 4a4cb1f940dd7873d4187d5b1cae1261ca3c849566457d702aa94d9f754908c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ab9066162444bd414c5cc9d45fbaf80ed91d438d1892064661362fffa60fdf2bcb09124e1a53883b5cd285c1f7c58c233dfb643dce0a2084168e2b2cdf7d8e
|
7
|
+
data.tar.gz: 67d6820b4c14a418761200069f158068ce74473b366b01d448f4eea5f98118fd8fa484a1f8fcc37480a43ea72c45cdcfb3689cf737e397dab24b77a421208a0d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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
|
-
#
|
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.
|
data/knapsack.gemspec
CHANGED
@@ -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', '
|
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'
|
data/lib/knapsack/config/env.rb
CHANGED
@@ -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
|
data/lib/knapsack/presenter.rb
CHANGED
@@ -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://
|
64
|
+
str << "\nhttps://docs.knapsackpro.com/ruby/knapsack#faq"
|
65
65
|
str << "\n=================================================\n"
|
66
|
-
str << %{
|
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
|
data/lib/knapsack/tracker.rb
CHANGED
data/lib/knapsack/version.rb
CHANGED
@@ -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.
|
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:
|
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
|
-
|
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
|