rspec_chunked 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/rspec_chunked/chunked_tests.rb +4 -3
- data/lib/rspec_chunked/version.rb +1 -1
- data/lib/tasks/rspec_chunked_tasks.rake +15 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88f625eba156da0e0603f45ad62a72aba2a1bb9c42c390cc25f0e2873e8491e9
|
4
|
+
data.tar.gz: 437165f8a02ebc862ea7553f0b9345f3a325ac9c93134a15c52ddde227a2662b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed38c5c6cdd3cad36f5d29123626303e62557acc7ae60761f5a484d481230cd54e1500dd01dcb47dbda41581216deb66fb9f5b3809926d50a13c74aa1ea6e496
|
7
|
+
data.tar.gz: 3885e21242709317eaa7df72aad821330ee1025a6c9768a98e1b524a824358d2c8f8ba67285b0411266d8ae7aecd5c1628ac154acb0ff3a81304f1e17cc88c4b
|
data/README.md
CHANGED
@@ -25,9 +25,18 @@ If ordering is not enough, permits to balance manually by moving x percentage of
|
|
25
25
|
Balance tests by moving 15% tests files from group 1 into group 2 and moving 10% tests files from group 4 into group 3
|
26
26
|
|
27
27
|
## Usage
|
28
|
-
|
28
|
+
- Basic initialization
|
29
|
+
` CI_JOBS=3 CI_JOB=1 rake rspec_chunked`
|
30
|
+
- Custom initialization
|
31
|
+
` CI_JOBS=3 CI_JOB=1 CI_CMD="bundle exec rspec ..." rake rspec_chunked`
|
29
32
|
- `CI_JOBS`: quantity of groups/workers to be split
|
30
33
|
- `CI_JOB`: current group/worker to be executed, limit: 1 until CI_JOBS
|
34
|
+
- `CI_CMD`: Custom rspec command
|
35
|
+
|
36
|
+
### Coverage merge reports (when using [simplecov](https://github.com/simplecov-ruby/simplecov#merging-test-runs-under-different-execution-environments))
|
37
|
+
This task will merge all coverage reports
|
38
|
+
`rake rspec_chunked:merge_reports`
|
39
|
+
|
31
40
|
|
32
41
|
### Github workflow result
|
33
42
|
- Before:
|
@@ -5,12 +5,13 @@ module RspecChunked
|
|
5
5
|
class << self
|
6
6
|
attr_accessor :balance_settings
|
7
7
|
end
|
8
|
-
attr_accessor :qty_groups, :job_number, :balance_settings
|
8
|
+
attr_accessor :qty_groups, :job_number, :balance_settings, :cmd
|
9
9
|
|
10
|
-
def initialize(qty_groups, job_number)
|
10
|
+
def initialize(qty_groups, job_number, cmd: '')
|
11
11
|
@qty_groups = qty_groups
|
12
12
|
@job_number = job_number - 1
|
13
13
|
@balance_settings = self.class.balance_settings || {}
|
14
|
+
@cmd = cmd.empty? ? 'bundle exec rspec' : cmd
|
14
15
|
end
|
15
16
|
|
16
17
|
def run
|
@@ -18,7 +19,7 @@ module RspecChunked
|
|
18
19
|
tests = balanced_tests[job_number]
|
19
20
|
qty = balanced_tests.flatten.count
|
20
21
|
Kernel.puts "**** running #{tests.count}/#{qty} tests (group number: #{job_number + 1})"
|
21
|
-
Kernel.exec "
|
22
|
+
Kernel.exec "#{cmd} #{tests.join(' ')}"
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
@@ -4,7 +4,20 @@ desc 'Run chunked rspec tests on specific qty, sample: CI_JOBS=3 CI_JOB=1 rake r
|
|
4
4
|
task rspec_chunked: :environment do
|
5
5
|
qty_jobs = (ENV['CI_JOBS'] || 3).to_i
|
6
6
|
job_number = (ENV['CI_JOB'] || 1).to_i
|
7
|
-
|
8
|
-
service = RspecChunked::ChunkedTests.new(qty_jobs, job_number)
|
7
|
+
service = RspecChunked::ChunkedTests.new(qty_jobs, job_number, cmd: ENV['CI_CMD'])
|
9
8
|
service.run
|
9
|
+
copy_coverage
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_coverage
|
13
|
+
path = 'coverage/.resultset.json'
|
14
|
+
FileUtils.cp path, "coverage/.resultset-#{job_number}.json" if File.exist?(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :rspec_chunked do
|
18
|
+
desc 'Collates all result sets generated by the different test runners'
|
19
|
+
task :merge_reports do
|
20
|
+
require 'simplecov'
|
21
|
+
SimpleCov.collate Dir['coverage/.resultset-*']
|
22
|
+
end
|
10
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_chunked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- owen2345
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|