ci-helper 0.3.0 → 0.4.2
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/.github/workflows/test.yml +61 -0
- data/.rubocop.yml +4 -0
- data/README.md +12 -3
- data/lib/ci_helper/cli.rb +8 -7
- data/lib/ci_helper/commands.rb +7 -0
- data/lib/ci_helper/commands/check_coverage.rb +10 -2
- data/lib/ci_helper/commands/check_sidekiq_scheduler_config.rb +44 -0
- data/lib/ci_helper/commands/run_specs.rb +2 -2
- data/lib/ci_helper/version.rb +1 -1
- metadata +8 -7
- data/.github/workflows/ruby.yml +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b4de79227e8355d1648143f4d35abcd08c1ddf9be79f4ad32521c734a4fb74e
|
4
|
+
data.tar.gz: 9d0d15a617492173e9e331fd973fe71894ed4d2f81ac512e2ba2ca754507c23f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3025f9be4194acd855eabe134d7b1f28f2209e84e11f4e5d974b32ef086f85b6a37bb226303b674dd2b4151b17250a9b3f613df66369a1c346b99f83dc28426
|
7
|
+
data.tar.gz: 48a8fddce07d4587935d4901e912a0e6e58d41c281251e87668d283892c9b722878c0429214c96c7b474347461dca56fec4d5b0bad8b72cbc97e095469a160df
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
|
10
|
+
env:
|
11
|
+
FULL_COVERAGE_CHECK: true
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
full-check:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 3
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Build and install gem to systems gems
|
24
|
+
run: bundle exec rake install
|
25
|
+
- name: Run Linter
|
26
|
+
run: bundle exec ci-helper RubocopLint
|
27
|
+
- name: Check missed spec suffixes
|
28
|
+
run: bundle exec ci-helper CheckSpecSuffixes --extra-paths spec/*.rb --ignored-paths spec/*_helper.rb
|
29
|
+
- name: Run specs
|
30
|
+
run: bundle exec ci-helper RunSpecs
|
31
|
+
- name: Audit
|
32
|
+
run: bundle exec ci-helper BundlerAudit
|
33
|
+
- name: Coveralls
|
34
|
+
uses: coverallsapp/github-action@master
|
35
|
+
with:
|
36
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
37
|
+
specs:
|
38
|
+
runs-on: ubuntu-latest
|
39
|
+
continue-on-error: ${{ matrix.experimental }}
|
40
|
+
|
41
|
+
env:
|
42
|
+
FULL_TEST_COVERAGE_CHECK: false
|
43
|
+
|
44
|
+
strategy:
|
45
|
+
fail-fast: false
|
46
|
+
matrix:
|
47
|
+
ruby: [2.5, 2.6, 2.7]
|
48
|
+
experimental: [false]
|
49
|
+
include:
|
50
|
+
- ruby: head
|
51
|
+
experimental: true
|
52
|
+
|
53
|
+
|
54
|
+
steps:
|
55
|
+
- uses: actions/checkout@v2
|
56
|
+
- uses: ruby/setup-ruby@v1
|
57
|
+
with:
|
58
|
+
ruby-version: ${{ matrix.ruby }}
|
59
|
+
bundler-cache: true
|
60
|
+
- name: Run specs
|
61
|
+
run: bundle exec rspec
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -31,8 +31,10 @@ A command can accept list of options (parameters). Option values are passed thro
|
|
31
31
|
For example, the BundlerAudit command accepts the ignored_advisories option
|
32
32
|
You can set a value of this option by setting the flag `--ignored-advisories ignored-advisory`.
|
33
33
|
It should be noted that all hyphens in flag names are automatically replaced with underscores.
|
34
|
+
If command accepts array as option's value, you can separate values with either commas or spaces.
|
34
35
|
```bash
|
35
|
-
$ ci-helper BundlerAudit --ignored-advisories first,second
|
36
|
+
$ ci-helper BundlerAudit --ignored-advisories first,second # Valid
|
37
|
+
$ ci-helper BundlerAudit --ignored-advisories first second # Valid too!
|
36
38
|
```
|
37
39
|
|
38
40
|
List of available commands:
|
@@ -63,12 +65,19 @@ List of available commands:
|
|
63
65
|
* `--ignored-paths [values]` - accepts path patterns that should be ignored,
|
64
66
|
delimited by coma.
|
65
67
|
* **CheckCoverage** — checks coverage by executing `SimpleCov::collate`.
|
66
|
-
|
67
|
-
Accepted flags: `--split-resultset`.
|
68
|
+
Accepted flags: `--split-resultset`, `--setup-file-path`.
|
68
69
|
* `--split-resultset` — if you execute command `RunSpecs` with `--split-resultset true`,
|
69
70
|
you also should set this flag to `true`. If this flag set to `true`, final coverage will be
|
70
71
|
calculated by merging results in all files, matching the mask `coverage/resultset.*.json`.
|
71
72
|
By default final coverage is calculated using result from `coverage/.resultset.json`.
|
73
|
+
* `--setup-file-path` — relative path to your `.rb` file, which setups `SimpleCov`.
|
74
|
+
Usually it is `spec_helper.rb`.
|
75
|
+
* **CheckSidekiqSchedulerConfig** — checks `sidekiq_scheduler` config by trying to resolve jobs constants via `rails runner`.
|
76
|
+
Accepted flags: `--config-path`
|
77
|
+
* `--config-path` — relative path to your config yaml file with schedule.
|
78
|
+
Usually it is `config/sidekiq_scheduler.yml`.
|
79
|
+
* `--with-database` — if you want to prepare database before executing specs,
|
80
|
+
you should set this flag to `true`.
|
72
81
|
|
73
82
|
### Rake Tasks
|
74
83
|
|
data/lib/ci_helper/cli.rb
CHANGED
@@ -26,13 +26,14 @@ module CIHelper
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def parse_options_from(args)
|
29
|
-
args
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
args
|
30
|
+
.slice_when { |_el_before, el_after| el_after.start_with?("--") }
|
31
|
+
.each_with_object({}) do |commands, options|
|
32
|
+
key = Tools::Inflector.instance.underscore(commands.shift.split("--").last)
|
33
|
+
raise "Invalid options" if key.empty?
|
34
|
+
value = commands.size <= 1 ? commands.first : commands
|
35
|
+
options[key.to_sym] = value || ""
|
36
|
+
end
|
36
37
|
end
|
37
38
|
|
38
39
|
def perform_command!
|
data/lib/ci_helper/commands.rb
CHANGED
@@ -54,8 +54,15 @@ module CIHelper
|
|
54
54
|
raise Error, message
|
55
55
|
end
|
56
56
|
|
57
|
+
def boolean_option(key)
|
58
|
+
options[key] == "true"
|
59
|
+
end
|
60
|
+
|
57
61
|
def plural_option(key)
|
58
62
|
return [] unless options.key?(key)
|
63
|
+
value = options[key]
|
64
|
+
return value if value.is_a?(Array)
|
65
|
+
|
59
66
|
options[key].split(",")
|
60
67
|
end
|
61
68
|
|
@@ -1,10 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "simplecov"
|
4
|
+
|
3
5
|
module CIHelper
|
4
6
|
module Commands
|
5
7
|
class CheckCoverage < BaseCommand
|
6
8
|
def call
|
7
|
-
|
9
|
+
require(path.join(setup_file_path)) unless setup_file_path.nil?
|
10
|
+
|
11
|
+
::SimpleCov.collate(files)
|
8
12
|
0
|
9
13
|
end
|
10
14
|
|
@@ -17,7 +21,11 @@ module CIHelper
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def split_resultset?
|
20
|
-
|
24
|
+
boolean_option(:split_resultset)
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_file_path
|
28
|
+
options[:setup_file_path]
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
module CIHelper
|
6
|
+
module Commands
|
7
|
+
class CheckSidekiqSchedulerConfig < BaseCommand
|
8
|
+
def call
|
9
|
+
return 0 if job_constants.empty?
|
10
|
+
|
11
|
+
create_and_migrate_database! if with_database?
|
12
|
+
cmd = craft_jobs_const_get_cmd
|
13
|
+
execute_with_rails_runner(cmd)
|
14
|
+
0
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def env
|
20
|
+
:development
|
21
|
+
end
|
22
|
+
|
23
|
+
def execute_with_rails_runner(cmd)
|
24
|
+
execute("bundle exec rails runner '#{cmd}'")
|
25
|
+
end
|
26
|
+
|
27
|
+
def craft_jobs_const_get_cmd
|
28
|
+
"#{job_constants}.each { |x| Object.const_get(x) }"
|
29
|
+
end
|
30
|
+
|
31
|
+
def job_constants
|
32
|
+
@job_constants ||= config.values.reject(&:nil?).flat_map(&:keys).uniq
|
33
|
+
end
|
34
|
+
|
35
|
+
def with_database?
|
36
|
+
boolean_option(:with_database)
|
37
|
+
end
|
38
|
+
|
39
|
+
def config
|
40
|
+
@config ||= YAML.load_file(options[:config_path])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -37,11 +37,11 @@ module CIHelper
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def with_database?
|
40
|
-
|
40
|
+
boolean_option(:with_database)
|
41
41
|
end
|
42
42
|
|
43
43
|
def split_resultset?
|
44
|
-
|
44
|
+
boolean_option(:split_resultset)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/ci_helper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JustAnotherDude
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -173,7 +173,7 @@ extensions: []
|
|
173
173
|
extra_rdoc_files: []
|
174
174
|
files:
|
175
175
|
- ".editorconfig"
|
176
|
-
- ".github/workflows/
|
176
|
+
- ".github/workflows/test.yml"
|
177
177
|
- ".gitignore"
|
178
178
|
- ".rspec"
|
179
179
|
- ".rubocop.yml"
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/ci_helper/commands/check_coverage.rb
|
194
194
|
- lib/ci_helper/commands/check_db_development.rb
|
195
195
|
- lib/ci_helper/commands/check_db_rollback.rb
|
196
|
+
- lib/ci_helper/commands/check_sidekiq_scheduler_config.rb
|
196
197
|
- lib/ci_helper/commands/check_spec_suffixes.rb
|
197
198
|
- lib/ci_helper/commands/rubocop_lint.rb
|
198
199
|
- lib/ci_helper/commands/run_specs.rb
|
@@ -207,7 +208,7 @@ licenses:
|
|
207
208
|
metadata:
|
208
209
|
homepage_uri: https://github.com/umbrellio/ci_helper
|
209
210
|
source_code_uri: https://github.com/umbrellio/ci_helper
|
210
|
-
post_install_message:
|
211
|
+
post_install_message:
|
211
212
|
rdoc_options: []
|
212
213
|
require_paths:
|
213
214
|
- lib
|
@@ -222,8 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
223
|
- !ruby/object:Gem::Version
|
223
224
|
version: '0'
|
224
225
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
226
|
-
signing_key:
|
226
|
+
rubygems_version: 3.2.15
|
227
|
+
signing_key:
|
227
228
|
specification_version: 4
|
228
229
|
summary: Continuous Integration helpers for Ruby
|
229
230
|
test_files: []
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
env:
|
17
|
-
FULL_COVERAGE_CHECK: true
|
18
|
-
|
19
|
-
jobs:
|
20
|
-
test-latest:
|
21
|
-
|
22
|
-
runs-on: ubuntu-latest
|
23
|
-
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
- name: Set up Ruby
|
27
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
-
# uses: ruby/setup-ruby@v1
|
30
|
-
uses: ruby/setup-ruby@v1
|
31
|
-
with:
|
32
|
-
ruby-version: 2.7
|
33
|
-
- name: Install dependencies
|
34
|
-
run: bundle install && gem install bundler-audit
|
35
|
-
- name: Build and install gem to systems gems
|
36
|
-
run: bundle exec rake install
|
37
|
-
- name: Run Linter
|
38
|
-
run: ci-helper RubocopLint
|
39
|
-
- name: Check missed spec suffixes
|
40
|
-
run: ci-helper CheckSpecSuffixes --extra-paths spec/*.rb --ignored-paths spec/*_helper.rb
|
41
|
-
- name: Run specs
|
42
|
-
run: ci-helper RunSpecs
|
43
|
-
- name: Audit
|
44
|
-
run: ci-helper BundlerAudit
|
45
|
-
- name: Coveralls
|
46
|
-
uses: coverallsapp/github-action@v1.1.1
|
47
|
-
with:
|
48
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
49
|
-
specs-for-26:
|
50
|
-
runs-on: ubuntu-latest
|
51
|
-
|
52
|
-
steps:
|
53
|
-
- uses: actions/checkout@v2
|
54
|
-
- name: Set up Ruby
|
55
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
56
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
57
|
-
# uses: ruby/setup-ruby@v1
|
58
|
-
uses: ruby/setup-ruby@v1
|
59
|
-
with:
|
60
|
-
ruby-version: 2.6
|
61
|
-
- name: Install dependencies
|
62
|
-
run: bundle install && gem install bundler-audit
|
63
|
-
- name: Build and install gem to systems gems
|
64
|
-
run: bundle exec rake install
|
65
|
-
- name: Run specs
|
66
|
-
run: ci-helper RunSpecs
|
67
|
-
specs-for-25:
|
68
|
-
runs-on: ubuntu-latest
|
69
|
-
|
70
|
-
steps:
|
71
|
-
- uses: actions/checkout@v2
|
72
|
-
- name: Set up Ruby
|
73
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
74
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
75
|
-
# uses: ruby/setup-ruby@v1
|
76
|
-
uses: ruby/setup-ruby@v1
|
77
|
-
with:
|
78
|
-
ruby-version: 2.5
|
79
|
-
- name: Install dependencies
|
80
|
-
run: bundle install && gem install bundler-audit
|
81
|
-
- name: Build and install gem to systems gems
|
82
|
-
run: bundle exec rake install
|
83
|
-
- name: Run specs
|
84
|
-
run: ci-helper RunSpecs
|