Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test against latest Ruby and Rails #326

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
rails-version:
- '6.0'
- '6.1'
- '7.0'
name: 'Ruby ${{ matrix.ruby-version }}, Rails ${{ matrix.rails-version }}'
# To keep matrix size down, only test highest and lowest rubies.
ruby: ["2.7", "3.3"]
rails: ["6.1", "7.0", "7.1", "7.2"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there any particular reason to drop 6.0 support?

Copy link
Contributor Author

@zhuravel zhuravel Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve removed support for Rails 6.0 as tests are failing on this version. Although the test build was showing as green, it was actually running on Rails 6.1 instead of 6.0. This happened because the Gemfile used ~> 6.0, which incorrectly installed Rails 6.1. To truly use Rails 6.0, the Gemfile should have specified ~> 6.0.0.

I chose not to reintroduce these hacks, and instead, I believe it’s time to officially drop support for this long end-of-life Rails version.

Here’s a screenshot for reference:

2024-09-04 20-28-18

exclude:
- ruby: "2.7"
rails: "7.2"
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}.gemfile
steps:
- uses: actions/checkout@v3
- uses: supercharge/mongodb-github-action@1.9.0
- uses: actions/checkout@v4
- uses: supercharge/mongodb-github-action@1.11.0
- uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ matrix.ruby-version }}'
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
env:
TEST_RAILS_VERSION: '${{ matrix.rails-version }}'
- run: bundle exec rake
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ wiki
.ruby-version
.ruby-gemset
Gemfile.lock
gemfiles/*.gemfile.lock
tmp

27 changes: 27 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
appraise "rails-6.1" do
group :development do
gem "rails", "~> 6.1.0"
end
end

appraise "rails-7.0" do
group :development do
gem "rails", "~> 7.0.0"
end
end

appraise "rails-7.1" do
group :development do
gem "rails", "~> 7.1.0"
end
end

appraise "rails-7.2" do
group :development do
gem "rails", "~> 7.2.0"
gem "sqlite3", "~> 2.0.0"
group :mongo do
gem "mongoid", github: "mongodb/mongoid"
end
end
end
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Treat true/false as YES/NO when assigned as strings for xboolean filter
* Support infinite ranges for date, datetime and integer filters
* Treat `ActiveRecord::Result` class as `Array` driver
* Drop support of Rails 6.0 [#326](https://github.com/bogdan/datagrid/pull/326)

## 1.8.1

Expand All @@ -20,9 +21,9 @@
## 1.7.0

* Depend on `railties` instead of `rails` to prevent loading of unnecessary frameworks
* Bugfix `File.exist?` usage for ruby 3.0 [#307](https://github.com/bogdan/datagrid/issues/307)
* Drop support of old Ruby versions (< 2.7)
* Drop support of old Rails versions (< 6.0)
* Bugfix `File.exist?` usage for Ruby 3.0 [#307](https://github.com/bogdan/datagrid/issues/307)
* Drop support of old Ruby versions (< 2.7) [#305](https://github.com/bogdan/datagrid/pull/305)
* Drop support of old Rails versions (< 6.0) [#305](https://github.com/bogdan/datagrid/pull/305)

## 1.6.3

Expand Down
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing to Datagrid
Copy link
Owner

@bogdan bogdan Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file somehow reachable from github UI? If not, I think it is better to make it a paragraph in Readme or at least link it from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guidelines should be visible when creating an issue or pull request:
https://github.blog/news-insights/contributing-guidelines/#contributors-wanted-inquire-within

CONTRIBUTING.md is commonly used to keep the README concise, which is why I created it separately. However, I’ll go ahead and add a link to CONTRIBUTING.md in the README to make it more accessible.


## Issues

Please use GitHub issues for bug reports and feature suggestions.

## Development

### Testing

Tests can be run against different versions of Rails:

**Using appraisals (recommended)**

``` shell
# Install the dependencies for each appraisal
bundle install
bundle exec appraisal install

# Run tests against Rails 7.2
bundle exec appraisal rails-7.2 rake

# Run tests against Rails 6.1
bundle exec appraisal rails-6.1 rake
```

**Using BUNDLE_GEMFILE**

``` shell
# Run tests against Rails 7.2
BUNDLE_GEMFILE=gemfiles/rails_7.2.gemfile bundle install
BUNDLE_GEMFILE=gemfiles/rails_7.2.gemfile bundle exec rake

# Run tests against Rails 6.1
BUNDLE_GEMFILE=gemfiles/rails_6.1.gemfile bundle install
BUNDLE_GEMFILE=gemfiles/rails_6.1.gemfile bundle exec rake
```
14 changes: 5 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ source "https://rubygems.org"
gemspec

group :development do
rails_version = ENV['TEST_RAILS_VERSION']
gem "rails", "~> #{rails_version}" if rails_version
gem "appraisal"
gem "bump"

gem "csv" # removed from standard library in Ruby 3.4
gem "nokogiri" # used to test html output
gem "pry-byebug"

gem "rspec"
gem "nokogiri" # used to test html output

gem "sqlite3", '~> 1.4.0'
gem "sequel"
gem "activerecord"
gem "sqlite3", "~> 1.7.0"

group :mongo do
gem "mongoid", '~> 9.0.0'
gem "bson"
gem "mongoid", "~> 9.0"
end
end
8 changes: 4 additions & 4 deletions Readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ A really mighty and flexible ruby library that generates reports including admin

[Create an issue](https://github.com/bogdan/datagrid/issues/new) if you want more.


### Documentation

* [Readme](/Readme.markdown) - this read-me for basic information
Expand Down Expand Up @@ -101,7 +100,6 @@ In order to create a report, you need to define:
* filters that will be used to filter data
* columns that should be displayed and sortable (if possible)


### Scope

Default scope of objects to filter and display.
Expand Down Expand Up @@ -139,7 +137,6 @@ Datagrid supports different type of filters including:

[More about filters](https://github.com/bogdan/datagrid/wiki/Filters)


### Columns

Each column is represented by name and code block to calculate the value.
Expand Down Expand Up @@ -193,6 +190,10 @@ All advanced frontend things are described in:

If you have a question of any kind, just make an issue and describe your problem in details.

## Contribution

If you are interested in contributing to this project, please follow the [instructions here](CONTRIBUTING.md).

## Self-Promotion

Like datagrid?
Expand All @@ -201,6 +202,5 @@ Follow the repository on [GitHub](https://github.com/bogdan/datagrid).

Read [author blog](http://gusiev.com).


## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid?ref=badge_large)
2 changes: 1 addition & 1 deletion datagrid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Gem::Specification.new do |s|
"source_code_uri" => s.homepage,
}

s.add_dependency "railties", ">= 6.0"
s.add_dependency "railties", ">= 6.1"
end

22 changes: 22 additions & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "https://rubygems.org"

group :development do
gem "appraisal"
gem "bump"
gem "csv"
gem "nokogiri"
gem "pry-byebug"
gem "rspec"
gem "sequel"
gem "sqlite3", "~> 1.7.0"
gem "rails", "~> 6.1.0"

group :mongo do
gem "bson"
gem "mongoid", "~> 9.0"
end
end

gemspec path: "../"
22 changes: 22 additions & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "https://rubygems.org"

group :development do
gem "appraisal"
gem "bump"
gem "csv"
gem "nokogiri"
gem "pry-byebug"
gem "rspec"
gem "sequel"
gem "sqlite3", "~> 1.7.0"
gem "rails", "~> 7.0.0"

group :mongo do
gem "bson"
gem "mongoid", "~> 9.0"
end
end

gemspec path: "../"
22 changes: 22 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "https://rubygems.org"

group :development do
gem "appraisal"
gem "bump"
gem "csv"
gem "nokogiri"
gem "pry-byebug"
gem "rspec"
gem "sequel"
gem "sqlite3", "~> 1.7.0"
gem "rails", "~> 7.1.0"

group :mongo do
gem "bson"
gem "mongoid", "~> 9.0"
end
end

gemspec path: "../"
22 changes: 22 additions & 0 deletions gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "https://rubygems.org"

group :development do
gem "appraisal"
gem "bump"
gem "csv"
gem "nokogiri"
gem "pry-byebug"
gem "rspec"
gem "sequel"
gem "sqlite3", "~> 2.0.0"
gem "rails", "~> 7.2.0"

group :mongo do
gem "bson"
gem "mongoid", github: "mongodb/mongoid"
end
end

gemspec path: "../"