Skip to content

Commit

Permalink
Drop support for older rubies, rails and redis
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Nov 18, 2024
1 parent 08806db commit 1aa3cd6
Show file tree
Hide file tree
Showing 62 changed files with 53 additions and 219 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ jobs:
# truffleruby,
# truffleruby-head,
# removing jruby again to flaky
gemfile: [ Gemfile.rails6.0, Gemfile.rails6.1, Gemfile.rails7.0, Gemfile.rails7.1 ]
gemfile: [ Gemfile.rails7.0, Gemfile.rails7.1, Gemfile.rails7.2, Gemfile.rails8.0 ]
# need to add support for multiple gemfiles
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]
redis-version: [4, 5, 6, 7]
exclude:
# Rails 8 requires ruby 3.2+.
- gemfile: 'rails_8.0'
ruby: '3.1'
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ temp_results
.env
log/
test/unique_files
test/rails5_dummy/tmp
test/rails7_dummy/tmp
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ require: standard

inherit_gem:
standard:
- config/ruby-2.7.yml
- config/ruby-3.1.yml
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"

# Specify your gem's dependencies in coverband.gemspec
gemspec
gem "rails", "~>7"
gem "rails" # latest
gem "haml"
gem "slim"
gem "webrick"
10 changes: 0 additions & 10 deletions Gemfile.rails6.1

This file was deleted.

4 changes: 2 additions & 2 deletions Gemfile.rails7 → Gemfile.rails7.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in coverband.gemspec
gemspec
gem 'rails', '~>7'
gem 'rails', '~>7.2.0'
gem "haml"
gem "slim"
gem "webrick"
gem "webrick"
4 changes: 2 additions & 2 deletions Gemfile.rails6.0 → Gemfile.rails8.0
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in coverband.gemspec
gemspec
gem "rails", "~>6.0.0"
gem 'rails', '~>8.0.0'
gem "haml"
gem "slim"
gem "webrick"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,14 @@ Outputs:

# Prerequisites

- Coverband 3.0.X+ requires Ruby 2.3+
- Ruby 3.1+
- Coverband currently requires Redis for production usage

### Ruby and Rails Version Support

We will match Heroku & Ruby's support lifetime, supporting the last 3 major Ruby releases. For details see [supported runtimes](https://devcenter.heroku.com/articles/ruby-support#supported-runtimes).

For Rails, we will follow the policy of the [Rails team maintenance policy](https://guides.rubyonrails.org/maintenance_policy.html). We officially support the last two major release versions, while providing minimal support (major bugs / security fixes) for an additional version. This means at the moment we primarily target Rails 6.x, 5.x, and will try to keep current functionality working for Rails 4.x but may release new features that do not work on that target.
For Rails, we will follow the policy of the [Rails team maintenance policy](https://guides.rubyonrails.org/maintenance_policy.html). We officially support the last two major release versions, while providing minimal support (major bugs / security fixes) for an additional version. At the moment we primarily target Rails 7.0+.

### JRuby Support

Expand Down
2 changes: 1 addition & 1 deletion coverband.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = %w[lib]

spec.required_ruby_version = ">= 2.7"
spec.required_ruby_version = ">= 3.1"

spec.metadata = {
"homepage_uri" => "https://github.com/danmayer/coverband",
Expand Down
2 changes: 1 addition & 1 deletion lib/coverband/collectors/abstract_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def save_report

# This is the basic rails version supported, if there is something more unique over ride in subclass
def self.supported_version?
defined?(Rails) && defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 5
defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 7
end

def route
Expand Down
4 changes: 2 additions & 2 deletions lib/coverband/collectors/route_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RouteTracker < AbstractTracker
TITLE = "Routes"

def initialize(options = {})
if Rails&.respond_to?(:version) && Gem::Version.new(Rails.version) >= Gem::Version.new("6.0.0") && Gem::Version.new(Rails.version) < Gem::Version.new("7.1.0")
if Rails&.respond_to?(:version) && Gem::Version.new(Rails.version) < Gem::Version.new("7.1.0")
require_relative "../utils/rails6_ext"
end

Expand Down Expand Up @@ -52,7 +52,7 @@ def track_key(payload)
end

def self.supported_version?
defined?(Rails) && defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 6
defined?(Rails) && defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 7
end

def unused_keys(used_keys = nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/coverband/collectors/view_tracker_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def save_report
end

def self.supported_version?
defined?(Rails) && defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 4
defined?(Rails::VERSION) && Rails::VERSION::STRING.split(".").first.to_i >= 7
end

private
Expand Down
4 changes: 0 additions & 4 deletions test/coverband/collectors/coverage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,12 @@ def teardown
end

test "using coverage state idle with ruby >= 3.1.0" do
return unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")

::Coverage.expects(:state).returns(:idle)
::Coverage.expects(:start).with(oneshot_lines: false)
Coverband::Collectors::Coverage.send(:new)
end

test "using coverage state suspended with ruby >= 3.1.0" do
return unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")

::Coverage.expects(:state).returns(:suspended).at_least_once
::Coverage.expects(:resume)
Coverband::Collectors::Coverage.send(:new)
Expand Down
15 changes: 0 additions & 15 deletions test/rails4_dummy/config/application.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails4_dummy/config/coverband.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails4_dummy/config/coverband_missing_redis.rb

This file was deleted.

6 changes: 0 additions & 6 deletions test/rails5_dummy/Rakefile

This file was deleted.

5 changes: 0 additions & 5 deletions test/rails5_dummy/app/controllers/dummy_controller.rb

This file was deleted.

16 changes: 0 additions & 16 deletions test/rails5_dummy/app/controllers/dummy_view_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions test/rails5_dummy/app/views/dummy_view/show.html.erb

This file was deleted.

4 changes: 0 additions & 4 deletions test/rails5_dummy/app/views/dummy_view/show_haml.html.haml

This file was deleted.

4 changes: 0 additions & 4 deletions test/rails5_dummy/app/views/dummy_view/show_slim.html.slim

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails5_dummy/config.ru

This file was deleted.

14 changes: 0 additions & 14 deletions test/rails5_dummy/config/application.rb

This file was deleted.

15 changes: 0 additions & 15 deletions test/rails5_dummy/config/coverband.rb

This file was deleted.

14 changes: 0 additions & 14 deletions test/rails5_dummy/config/coverband_missing_redis.rb

This file was deleted.

2 changes: 0 additions & 2 deletions test/rails5_dummy/config/environment.rb

This file was deleted.

7 changes: 0 additions & 7 deletions test/rails5_dummy/config/routes.rb

This file was deleted.

Empty file removed test/rails5_dummy/tmp/.keep
Empty file.
6 changes: 0 additions & 6 deletions test/rails6_dummy/Rakefile

This file was deleted.

5 changes: 0 additions & 5 deletions test/rails6_dummy/app/controllers/dummy_controller.rb

This file was deleted.

16 changes: 0 additions & 16 deletions test/rails6_dummy/app/controllers/dummy_view_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions test/rails6_dummy/app/views/dummy_view/show.html.erb

This file was deleted.

4 changes: 0 additions & 4 deletions test/rails6_dummy/app/views/dummy_view/show_haml.html.haml

This file was deleted.

4 changes: 0 additions & 4 deletions test/rails6_dummy/app/views/dummy_view/show_slim.html.slim

This file was deleted.

4 changes: 0 additions & 4 deletions test/rails6_dummy/config.ru

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails6_dummy/config/boot.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails6_dummy/config/coverband.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails6_dummy/config/coverband_missing_redis.rb

This file was deleted.

5 changes: 0 additions & 5 deletions test/rails6_dummy/config/environment.rb

This file was deleted.

7 changes: 0 additions & 7 deletions test/rails6_dummy/config/routes.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/rails6_dummy/config/secrets.yml

This file was deleted.

Empty file removed test/rails6_dummy/tmp/.keep
Empty file.
14 changes: 13 additions & 1 deletion test/rails7_dummy/config/coverband.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# frozen_string_literal: true

require_relative "../../rails5_dummy/config/coverband"
Coverband.configure do |config|
# NOTE: we reuse this config in each of the fake rails projects
# the below ensures the root is set to the correct fake project
config.root = ::File.expand_path("../../../", __FILE__).to_s + "/rails#{Rails::VERSION::MAJOR}_dummy"
config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: ENV["REDIS_URL"]), redis_namespace: "coverband_test") if defined? Redis
config.ignore = %w[.erb$ .slim$]
config.root_paths = []
config.logger = Rails.logger
config.verbose = true
config.background_reporting_enabled = true
config.track_routes = true
config.use_oneshot_lines_coverage = true if ENV["ONESHOT"]
end
13 changes: 12 additions & 1 deletion test/rails7_dummy/config/coverband_missing_redis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# frozen_string_literal: true

require_relative "../../rails5_dummy/config/coverband_missing_redis"
Coverband.configure do |config|
config.root = Dir.pwd
config.store = Coverband::Adapters::RedisStore.new(Redis.new(db: 2, url: "redis://127.0.0.1:123"), redis_namespace: "coverband_test") if defined? Redis
config.ignore = %w[vendor .erb$ .slim$]
config.root_paths = []
config.logger = Rails.logger
config.verbose = true
config.background_reporting_enabled = true
config.track_gems = true
config.gem_details = true
config.use_oneshot_lines_coverage = true if ENV["ONESHOT"]
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1aa3cd6

Please sign in to comment.