sidekiq-throttled 0.17.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +314 -0
  3. data/lib/sidekiq/throttled/config.rb +44 -0
  4. data/lib/sidekiq/throttled/cooldown.rb +55 -0
  5. data/lib/sidekiq/throttled/expirable_set.rb +70 -0
  6. data/lib/sidekiq/throttled/job.rb +4 -4
  7. data/lib/sidekiq/throttled/middlewares/server.rb +28 -0
  8. data/lib/sidekiq/throttled/patches/basic_fetch.rb +53 -0
  9. data/lib/sidekiq/throttled/registry.rb +4 -7
  10. data/lib/sidekiq/throttled/strategy/concurrency.rb +4 -6
  11. data/lib/sidekiq/throttled/strategy/threshold.rb +4 -6
  12. data/lib/sidekiq/throttled/strategy.rb +10 -10
  13. data/lib/sidekiq/throttled/strategy_collection.rb +2 -3
  14. data/lib/sidekiq/throttled/version.rb +1 -1
  15. data/lib/sidekiq/throttled/web.rb +2 -45
  16. data/lib/sidekiq/throttled/worker.rb +1 -1
  17. data/lib/sidekiq/throttled.rb +45 -57
  18. metadata +25 -70
  19. data/.coveralls.yml +0 -1
  20. data/.github/dependabot.yml +0 -12
  21. data/.github/workflows/ci.yml +0 -52
  22. data/.gitignore +0 -12
  23. data/.rspec +0 -5
  24. data/.rubocop.yml +0 -20
  25. data/.rubocop_todo.yml +0 -68
  26. data/.travis.yml +0 -37
  27. data/.yardopts +0 -1
  28. data/Appraisals +0 -9
  29. data/CHANGES.md +0 -300
  30. data/Gemfile +0 -34
  31. data/Guardfile +0 -25
  32. data/README.md +0 -297
  33. data/Rakefile +0 -27
  34. data/gemfiles/sidekiq_6.4.gemfile +0 -33
  35. data/gemfiles/sidekiq_6.5.gemfile +0 -33
  36. data/lib/sidekiq/throttled/communicator/callbacks.rb +0 -72
  37. data/lib/sidekiq/throttled/communicator/exception_handler.rb +0 -25
  38. data/lib/sidekiq/throttled/communicator/listener.rb +0 -109
  39. data/lib/sidekiq/throttled/communicator.rb +0 -116
  40. data/lib/sidekiq/throttled/configuration.rb +0 -50
  41. data/lib/sidekiq/throttled/expirable_list.rb +0 -70
  42. data/lib/sidekiq/throttled/fetch/unit_of_work.rb +0 -83
  43. data/lib/sidekiq/throttled/fetch.rb +0 -94
  44. data/lib/sidekiq/throttled/middleware.rb +0 -22
  45. data/lib/sidekiq/throttled/patches/queue.rb +0 -18
  46. data/lib/sidekiq/throttled/queue_name.rb +0 -46
  47. data/lib/sidekiq/throttled/queues_pauser.rb +0 -152
  48. data/lib/sidekiq/throttled/testing.rb +0 -12
  49. data/lib/sidekiq/throttled/utils.rb +0 -19
  50. data/lib/sidekiq/throttled/web/queues.html.erb +0 -49
  51. data/lib/sidekiq/throttled/web/summary_fix.js +0 -10
  52. data/lib/sidekiq/throttled/web/summary_fix.rb +0 -35
  53. data/rubocop/layout.yml +0 -24
  54. data/rubocop/lint.yml +0 -41
  55. data/rubocop/metrics.yml +0 -4
  56. data/rubocop/performance.yml +0 -25
  57. data/rubocop/rspec.yml +0 -3
  58. data/rubocop/style.yml +0 -84
  59. data/sidekiq-throttled.gemspec +0 -36
  60. /data/{LICENSE.md → LICENSE.txt} +0 -0
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "redis/prescription"
3
+ require "redis_prescription"
4
4
 
5
- require "sidekiq/throttled/strategy/base"
5
+ require_relative "./base"
6
6
 
7
7
  module Sidekiq
8
8
  module Throttled
@@ -30,7 +30,7 @@ module Sidekiq
30
30
  #
31
31
  # increase!
32
32
  # return 0
33
- SCRIPT = Redis::Prescription.read "#{__dir__}/threshold.lua"
33
+ SCRIPT = RedisPrescription.new(File.read("#{__dir__}/threshold.lua"))
34
34
  private_constant :SCRIPT
35
35
 
36
36
  # @param [#to_s] strategy_key
@@ -66,9 +66,7 @@ module Sidekiq
66
66
  keys = [key(job_args)]
67
67
  argv = [job_limit, period(job_args), Time.now.to_f]
68
68
 
69
- Sidekiq.redis do |redis|
70
- 1 == SCRIPT.eval(redis, :keys => keys, :argv => argv)
71
- end
69
+ Sidekiq.redis { |redis| 1 == SCRIPT.call(redis, keys: keys, argv: argv) }
72
70
  end
73
71
 
74
72
  # @return [Integer] Current count of jobs
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # internal
4
- require "sidekiq/throttled/errors"
5
- require "sidekiq/throttled/strategy_collection"
6
- require "sidekiq/throttled/strategy/concurrency"
7
- require "sidekiq/throttled/strategy/threshold"
4
+ require_relative "./errors"
5
+ require_relative "./strategy_collection"
6
+ require_relative "./strategy/concurrency"
7
+ require_relative "./strategy/threshold"
8
8
 
9
9
  module Sidekiq
10
10
  module Throttled
@@ -35,14 +35,14 @@ module Sidekiq
35
35
  @observer = observer
36
36
 
37
37
  @concurrency = StrategyCollection.new(concurrency,
38
- :strategy => Concurrency,
39
- :name => name,
40
- :key_suffix => key_suffix)
38
+ strategy: Concurrency,
39
+ name: name,
40
+ key_suffix: key_suffix)
41
41
 
42
42
  @threshold = StrategyCollection.new(threshold,
43
- :strategy => Threshold,
44
- :name => name,
45
- :key_suffix => key_suffix)
43
+ strategy: Threshold,
44
+ name: name,
45
+ key_suffix: key_suffix)
46
46
 
47
47
  return if @concurrency.any? || @threshold.any?
48
48
 
@@ -19,8 +19,7 @@ module Sidekiq
19
19
  # @param [#to_s] name
20
20
  # @param [#call] key_suffix Dynamic key suffix generator.
21
21
  def initialize(strategies, strategy:, name:, key_suffix:)
22
- strategies = (strategies.is_a?(Hash) ? [strategies] : Array(strategies))
23
- @strategies = strategies.map do |options|
22
+ @strategies = (strategies.is_a?(Hash) ? [strategies] : Array(strategies)).map do |options|
24
23
  make_strategy(strategy, name, key_suffix, options)
25
24
  end
26
25
  end
@@ -61,7 +60,7 @@ module Sidekiq
61
60
  return unless options
62
61
 
63
62
  strategy.new("throttled:#{name}",
64
- :key_suffix => key_suffix,
63
+ key_suffix: key_suffix,
65
64
  **options)
66
65
  end
67
66
  end
@@ -3,6 +3,6 @@
3
3
  module Sidekiq
4
4
  module Throttled
5
5
  # Gem version
6
- VERSION = "0.17.0"
6
+ VERSION = "1.1.0"
7
7
  end
8
8
  end
@@ -8,9 +8,8 @@ require "sidekiq"
8
8
  require "sidekiq/web"
9
9
 
10
10
  # internal
11
- require "sidekiq/throttled/registry"
12
- require "sidekiq/throttled/web/stats"
13
- require "sidekiq/throttled/web/summary_fix"
11
+ require_relative "./registry"
12
+ require_relative "./web/stats"
14
13
 
15
14
  module Sidekiq
16
15
  module Throttled
@@ -18,31 +17,11 @@ module Sidekiq
18
17
  module Web
19
18
  VIEWS = Pathname.new(__dir__).join("web")
20
19
  THROTTLED_TPL = VIEWS.join("throttled.html.erb").read.freeze
21
- QUEUES_TPL = VIEWS.join("queues.html.erb").read.freeze
22
20
 
23
21
  class << self
24
- # Replace default Queues tab with enhanced one.
25
- def enhance_queues_tab!
26
- SummaryFix.enabled = true
27
- Sidekiq::Web::DEFAULT_TABS["Queues"] = "enhanced-queues"
28
- Sidekiq::Web.tabs.delete("Enhanced Queues")
29
- end
30
-
31
- # Restore original Queues tab.
32
- #
33
- # @api There's next to absolutely no value in this method for real
34
- # users. The only it's purpose is to restore virgin state in specs.
35
- def restore_queues_tab!
36
- SummaryFix.enabled = false
37
- Sidekiq::Web::DEFAULT_TABS["Queues"] = "queues"
38
- Sidekiq::Web.tabs["Enhanced Queues"] = "enhanced-queues"
39
- end
40
-
41
22
  # @api private
42
23
  def registered(app)
43
- SummaryFix.apply! app
44
24
  register_throttled_tab app
45
- register_enhanced_queues_tab app
46
25
  end
47
26
 
48
27
  private
@@ -55,27 +34,6 @@ module Sidekiq
55
34
  redirect "#{root_path}throttled"
56
35
  end
57
36
  end
58
-
59
- # rubocop:disable Metrics/AbcSize
60
- def register_enhanced_queues_tab(app) # rubocop:disable Metrics/MethodLength
61
- pauser = QueuesPauser.instance
62
-
63
- app.get("/enhanced-queues") do
64
- @queues = Sidekiq::Queue.all
65
- erb QUEUES_TPL.dup
66
- end
67
-
68
- app.post("/enhanced-queues/:name") do
69
- case params[:action]
70
- when "delete" then Sidekiq::Queue.new(params[:name]).clear
71
- when "pause" then pauser.pause!(params[:name])
72
- else pauser.resume!(params[:name])
73
- end
74
-
75
- redirect "#{root_path}enhanced-queues"
76
- end
77
- end
78
- # rubocop:enable Metrics/AbcSize
79
37
  end
80
38
  end
81
39
  end
@@ -83,4 +41,3 @@ end
83
41
 
84
42
  Sidekiq::Web.register Sidekiq::Throttled::Web
85
43
  Sidekiq::Web.tabs["Throttled"] = "throttled"
86
- Sidekiq::Web.tabs["Enhanced Queues"] = "enhanced-queues"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sidekiq/throttled/job"
3
+ require_relative "./job"
4
4
 
5
5
  module Sidekiq
6
6
  module Throttled
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # 3rd party
4
3
  require "sidekiq"
5
4
 
6
- # internal
7
- require "sidekiq/throttled/version"
8
- require "sidekiq/throttled/communicator"
9
- require "sidekiq/throttled/configuration"
10
- require "sidekiq/throttled/queues_pauser"
11
- require "sidekiq/throttled/registry"
12
- require "sidekiq/throttled/job"
13
- require "sidekiq/throttled/worker"
14
- require "sidekiq/throttled/utils"
5
+ require_relative "./throttled/config"
6
+ require_relative "./throttled/cooldown"
7
+ require_relative "./throttled/job"
8
+ require_relative "./throttled/middlewares/server"
9
+ require_relative "./throttled/patches/basic_fetch"
10
+ require_relative "./throttled/registry"
11
+ require_relative "./throttled/version"
12
+ require_relative "./throttled/worker"
15
13
 
16
14
  # @see https://github.com/mperham/sidekiq/
17
15
  module Sidekiq
@@ -20,7 +18,6 @@ module Sidekiq
20
18
  # Just add somewhere in your bootstrap:
21
19
  #
22
20
  # require "sidekiq/throttled"
23
- # Sidekiq::Throttled.setup!
24
21
  #
25
22
  # Once you've done that you can include {Sidekiq::Throttled::Job} to your
26
23
  # job classes and configure throttling:
@@ -46,28 +43,29 @@ module Sidekiq
46
43
  MUTEX = Mutex.new
47
44
  private_constant :MUTEX
48
45
 
49
- class << self
50
- include Utils
46
+ @config = Config.new.freeze
47
+ @cooldown = Cooldown[@config]
51
48
 
52
- # @return [Configuration]
53
- def configuration
54
- @configuration ||= Configuration.new
55
- end
49
+ class << self
50
+ # @api internal
51
+ #
52
+ # @return [Cooldown, nil]
53
+ attr_reader :cooldown
56
54
 
57
- # Hooks throttler into sidekiq.
55
+ # @example
56
+ # Sidekiq::Throttled.configure do |config|
57
+ # config.cooldown_period = nil # Disable queues cooldown manager
58
+ # end
58
59
  #
59
- # @return [void]
60
- def setup!
61
- Communicator.instance.setup!
62
- QueuesPauser.instance.setup!
60
+ # @yieldparam config [Config]
61
+ def configure
62
+ MUTEX.synchronize do
63
+ config = @config.dup
63
64
 
64
- Sidekiq.configure_server do |config|
65
- setup_strategy!(config)
65
+ yield config
66
66
 
67
- require "sidekiq/throttled/middleware"
68
- config.server_middleware do |chain|
69
- chain.add Sidekiq::Throttled::Middleware
70
- end
67
+ @config = config.freeze
68
+ @cooldown = Cooldown[@config]
71
69
  end
72
70
  end
73
71
 
@@ -76,13 +74,13 @@ module Sidekiq
76
74
  # @param [String] message Job's JSON payload
77
75
  # @return [Boolean]
78
76
  def throttled?(message)
79
- message = JSON.parse message
80
- job = message.fetch("wrapped") { message.fetch("class") { return false } }
81
- jid = message.fetch("jid") { return false }
77
+ message = Sidekiq.load_json(message)
78
+ job = message.fetch("wrapped") { message["class"] }
79
+ jid = message["jid"]
82
80
 
83
- preload_constant! job
81
+ return false unless job && jid
84
82
 
85
- Registry.get job do |strategy|
83
+ Registry.get(job) do |strategy|
86
84
  return strategy.throttled?(jid, *message["args"])
87
85
  end
88
86
 
@@ -91,33 +89,23 @@ module Sidekiq
91
89
  false
92
90
  end
93
91
 
94
- private
95
-
96
- # @return [void]
97
- def setup_strategy!(sidekiq_config)
98
- require "sidekiq/throttled/fetch"
99
-
100
- # https://github.com/mperham/sidekiq/commit/67daa7a408b214d593100f782271ed108686c147
101
- sidekiq_config = sidekiq_config.options if Gem::Version.new(Sidekiq::VERSION) < Gem::Version.new("6.5.0")
102
-
103
- sidekiq_config[:fetch] = Sidekiq::Throttled::Fetch.new(sidekiq_config)
104
- end
92
+ # @deprecated Will be removed in 2.0.0
93
+ def setup!
94
+ warn "Sidekiq::Throttled.setup! was deprecated"
105
95
 
106
- # Tries to preload constant by it's name once.
107
- #
108
- # Somehow, sometimes, some classes are not eager loaded upon Rails init,
109
- # leading to throttling config not being registered prior job perform.
110
- # And that leaves us with concurrency limit + 1 situation upon Sidekiq
111
- # server restart (becomes normal after all Sidekiq processes handled
112
- # at leas onr job of that class).
113
- #
114
- # @return [void]
115
- def preload_constant!(job)
116
- MUTEX.synchronize do
117
- @preloaded ||= {}
118
- @preloaded[job] ||= constantize(job) || true
96
+ Sidekiq.configure_server do |config|
97
+ config.server_middleware do |chain|
98
+ chain.remove(Sidekiq::Throttled::Middlewares::Server)
99
+ chain.add(Sidekiq::Throttled::Middlewares::Server)
100
+ end
119
101
  end
120
102
  end
121
103
  end
122
104
  end
105
+
106
+ configure_server do |config|
107
+ config.server_middleware do |chain|
108
+ chain.add(Sidekiq::Throttled::Middlewares::Server)
109
+ end
110
+ end
123
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-throttled
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Zapparov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-14 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -16,96 +16,59 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis-prescription
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '2.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sidekiq
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '6.4'
47
+ version: '6.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '6.4'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '2.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '2.0'
69
- description: Concurrency and threshold throttling for Sidekiq.
54
+ version: '6.5'
55
+ description:
70
56
  email:
71
57
  - alexey@zapparov.com
72
58
  executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
76
- - ".coveralls.yml"
77
- - ".github/dependabot.yml"
78
- - ".github/workflows/ci.yml"
79
- - ".gitignore"
80
- - ".rspec"
81
- - ".rubocop.yml"
82
- - ".rubocop_todo.yml"
83
- - ".travis.yml"
84
- - ".yardopts"
85
- - Appraisals
86
- - CHANGES.md
87
- - Gemfile
88
- - Guardfile
89
- - LICENSE.md
90
- - README.md
91
- - Rakefile
92
- - gemfiles/sidekiq_6.4.gemfile
93
- - gemfiles/sidekiq_6.5.gemfile
62
+ - LICENSE.txt
63
+ - README.adoc
94
64
  - lib/sidekiq/throttled.rb
95
- - lib/sidekiq/throttled/communicator.rb
96
- - lib/sidekiq/throttled/communicator/callbacks.rb
97
- - lib/sidekiq/throttled/communicator/exception_handler.rb
98
- - lib/sidekiq/throttled/communicator/listener.rb
99
- - lib/sidekiq/throttled/configuration.rb
65
+ - lib/sidekiq/throttled/config.rb
66
+ - lib/sidekiq/throttled/cooldown.rb
100
67
  - lib/sidekiq/throttled/errors.rb
101
- - lib/sidekiq/throttled/expirable_list.rb
102
- - lib/sidekiq/throttled/fetch.rb
103
- - lib/sidekiq/throttled/fetch/unit_of_work.rb
68
+ - lib/sidekiq/throttled/expirable_set.rb
104
69
  - lib/sidekiq/throttled/job.rb
105
- - lib/sidekiq/throttled/middleware.rb
106
- - lib/sidekiq/throttled/patches/queue.rb
107
- - lib/sidekiq/throttled/queue_name.rb
108
- - lib/sidekiq/throttled/queues_pauser.rb
70
+ - lib/sidekiq/throttled/middlewares/server.rb
71
+ - lib/sidekiq/throttled/patches/basic_fetch.rb
109
72
  - lib/sidekiq/throttled/registry.rb
110
73
  - lib/sidekiq/throttled/strategy.rb
111
74
  - lib/sidekiq/throttled/strategy/base.rb
@@ -114,27 +77,19 @@ files:
114
77
  - lib/sidekiq/throttled/strategy/threshold.lua
115
78
  - lib/sidekiq/throttled/strategy/threshold.rb
116
79
  - lib/sidekiq/throttled/strategy_collection.rb
117
- - lib/sidekiq/throttled/testing.rb
118
- - lib/sidekiq/throttled/utils.rb
119
80
  - lib/sidekiq/throttled/version.rb
120
81
  - lib/sidekiq/throttled/web.rb
121
- - lib/sidekiq/throttled/web/queues.html.erb
122
82
  - lib/sidekiq/throttled/web/stats.rb
123
- - lib/sidekiq/throttled/web/summary_fix.js
124
- - lib/sidekiq/throttled/web/summary_fix.rb
125
83
  - lib/sidekiq/throttled/web/throttled.html.erb
126
84
  - lib/sidekiq/throttled/worker.rb
127
- - rubocop/layout.yml
128
- - rubocop/lint.yml
129
- - rubocop/metrics.yml
130
- - rubocop/performance.yml
131
- - rubocop/rspec.yml
132
- - rubocop/style.yml
133
- - sidekiq-throttled.gemspec
134
85
  homepage: https://github.com/ixti/sidekiq-throttled
135
86
  licenses:
136
87
  - MIT
137
88
  metadata:
89
+ homepage_uri: https://github.com/ixti/sidekiq-throttled
90
+ source_code_uri: https://github.com/ixti/sidekiq-throttled/tree/v1.1.0
91
+ bug_tracker_uri: https://github.com/ixti/sidekiq-throttled/issues
92
+ changelog_uri: https://github.com/ixti/sidekiq-throttled/blob/v1.1.0/CHANGES.md
138
93
  rubygems_mfa_required: 'true'
139
94
  post_install_message:
140
95
  rdoc_options: []
@@ -144,15 +99,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
99
  requirements:
145
100
  - - ">="
146
101
  - !ruby/object:Gem::Version
147
- version: '2.7'
102
+ version: '3.0'
148
103
  required_rubygems_version: !ruby/object:Gem::Requirement
149
104
  requirements:
150
105
  - - ">="
151
106
  - !ruby/object:Gem::Version
152
107
  version: '0'
153
108
  requirements: []
154
- rubygems_version: 3.2.33
109
+ rubygems_version: 3.4.10
155
110
  signing_key:
156
111
  specification_version: 4
157
- summary: Concurrency and threshold throttling for Sidekiq.
112
+ summary: Concurrency and rate-limit throttling for Sidekiq
158
113
  test_files: []
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
@@ -1,12 +0,0 @@
1
- # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2
-
3
- version: 2
4
- updates:
5
- - package-ecosystem: "github-actions"
6
- directory: "/"
7
- schedule:
8
- interval: "daily"
9
- - package-ecosystem: "bundler"
10
- directory: "/"
11
- schedule:
12
- interval: "daily"
@@ -1,52 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- test:
11
- name: "rspec (ruby:${{ matrix.ruby }} sidekiq:${{ matrix.sidekiq }})"
12
-
13
- strategy:
14
- fail-fast: false
15
- matrix:
16
- ruby: [ "2.7", "3.0", "3.1" ]
17
- sidekiq: [ "6.4", "6.5" ]
18
-
19
- runs-on: ubuntu-latest
20
-
21
- services:
22
- redis:
23
- image: redis
24
- ports: ["6379:6379"]
25
- options: "--entrypoint redis-server"
26
-
27
- env:
28
- BUNDLE_GEMFILE: gemfiles/sidekiq_${{ matrix.sidekiq }}.gemfile
29
-
30
- steps:
31
- - uses: actions/checkout@v3
32
-
33
- - uses: ruby/setup-ruby@v1
34
- with:
35
- ruby-version: ${{ matrix.ruby }}
36
- bundler-cache: true
37
-
38
- - name: bundle exec rspec
39
- run: bundle exec rspec --format progress --force-colour
40
-
41
- rubocop:
42
- runs-on: ubuntu-latest
43
-
44
- steps:
45
- - uses: actions/checkout@v3
46
-
47
- - uses: ruby/setup-ruby@v1
48
- with:
49
- ruby-version: "2.7"
50
- bundler-cache: true
51
-
52
- - run: bundle exec rubocop
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /gemfiles/.bundle
5
- /gemfiles/*.gemfile.lock
6
- /_yardoc/
7
- /coverage/
8
- /doc/
9
- /pkg/
10
- /spec/reports/
11
- /tmp/
12
- .byebug_history
data/.rspec DELETED
@@ -1,5 +0,0 @@
1
- --backtrace
2
- --color
3
- --format=documentation
4
- --order random
5
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,20 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rake
4
- - rubocop-rspec
5
-
6
- inherit_from:
7
- - .rubocop_todo.yml
8
- - rubocop/layout.yml
9
- - rubocop/lint.yml
10
- - rubocop/metrics.yml
11
- - rubocop/performance.yml
12
- - rubocop/rspec.yml
13
- - rubocop/style.yml
14
-
15
- AllCops:
16
- Exclude:
17
- - gemfiles/**/*
18
- - vendor/**/*
19
- NewCops: enable
20
- TargetRubyVersion: 2.7