rspec_chunked 0.4.3 → 0.5
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 +4 -4
- data/README.md +4 -5
- data/lib/rspec_chunked/railtie.rb +5 -1
- data/lib/rspec_chunked/version.rb +1 -1
- data/lib/tasks/rspec_chunked_tasks.rake +9 -4
- 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: cc398c99a740b44f4503b351d0161a93db59a2ee50a87ce992d7863faf00278c
|
4
|
+
data.tar.gz: ac9a9e3cd8bd6dd05d4d20c191e8d59efba116a37be3f0fe8948e4267e11542d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533b28d0ddf8b52d6502527889364fa80537fcfb1e0d5aec1406030b408cff5f98cdf3517b8795f410969cef87c1e509137a6f33a28869bbded20341f4a660e8
|
7
|
+
data.tar.gz: 5f40aa1988ce2b4350ffcc7e9e065617df4533bf37ad101ff8efab95944a53a6796d807463459ef2ac132dcf0069eb6f63bb99e3e91bdc906bda4162a3ea3f7d
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ If ordering is not enough, permits to balance manually by moving x percentage of
|
|
15
15
|
|
16
16
|
- Add manual balance
|
17
17
|
```ruby
|
18
|
-
# config/
|
18
|
+
# config/rspec_chunked.rb
|
19
19
|
if defined?(RspecChunked::ChunkedTests)
|
20
20
|
data = { 1 => { to: 2, percentage: 15 },
|
21
21
|
4 => { to: 3, percentage: 10 } }
|
@@ -26,11 +26,10 @@ Balance tests by moving 15% tests files from group 1 into group 2 and moving 10%
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
- Basic initialization
|
29
|
-
` CI_JOBS=3
|
29
|
+
` CI_JOBS=1/3 rake rspec_chunked`
|
30
30
|
- Custom initialization
|
31
|
-
` CI_JOBS=3
|
32
|
-
- `CI_JOBS`: quantity of groups/
|
33
|
-
- `CI_JOB`: current group/worker to be executed, limit: 1 until CI_JOBS
|
31
|
+
` CI_JOBS=1/3 CI_CMD="bundle exec rspec ..." rake rspec_chunked`
|
32
|
+
- `CI_JOBS`: Current job number / quantity of groups/jobs to be split
|
34
33
|
- `CI_CMD`: Custom rspec command
|
35
34
|
|
36
35
|
### Coverage merge reports (when using [simplecov](https://github.com/simplecov-ruby/simplecov#merging-test-runs-under-different-execution-environments))
|
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'rspec_chunked'
|
3
4
|
require 'rails'
|
5
|
+
|
4
6
|
module RspecChunked
|
5
|
-
class Railtie <
|
7
|
+
class Railtie < Rails::Railtie
|
8
|
+
railtie_name :my_gem
|
9
|
+
|
6
10
|
rake_tasks do
|
7
11
|
load 'tasks/rspec_chunked_tasks.rake'
|
8
12
|
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
desc 'Run chunked rspec tests on specific qty, sample: CI_JOBS=3 CI_JOB=1 rake rspec_chunked'
|
4
|
-
task rspec_chunked
|
5
|
-
qty_jobs = (ENV['CI_JOBS'] || 3).
|
6
|
-
|
7
|
-
service = RspecChunked::ChunkedTests.new(qty_jobs, job_number, cmd: ENV['CI_CMD'])
|
4
|
+
task :rspec_chunked do
|
5
|
+
job_number, qty_jobs = (ENV['CI_JOBS'] || '1/3').split('/')
|
6
|
+
load_config
|
7
|
+
service = RspecChunked::ChunkedTests.new(qty_jobs.to_i, job_number.to_i, cmd: ENV['CI_CMD'])
|
8
8
|
service.run
|
9
9
|
copy_coverage(job_number)
|
10
10
|
end
|
11
11
|
|
12
|
+
def load_config
|
13
|
+
config_file = File.join(Dir.pwd, 'config', 'rspec_chunked.rb')
|
14
|
+
load config_file if File.exist?(config_file)
|
15
|
+
end
|
16
|
+
|
12
17
|
def copy_coverage(job_number)
|
13
18
|
path = 'coverage/.resultset.json'
|
14
19
|
FileUtils.cp path, "coverage/.resultset-#{job_number}.json" if File.exist?(path)
|
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.5'
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|