From 487e1debf30dfe50e7b70599f49bcd9272016b4a Mon Sep 17 00:00:00 2001 From: Bohdan Zhuravel Date: Wed, 4 Sep 2024 22:48:29 +0300 Subject: [PATCH] Test against latest Ruby and Rails (#326) * Test against latest Ruby and Rails * Mention contribution guidelines in README --- .github/workflows/ci.yml | 27 ++++++++++++--------------- .gitignore | 2 +- Appraisals | 27 +++++++++++++++++++++++++++ CHANGELOG.md | 7 ++++--- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ Gemfile | 14 +++++--------- Readme.markdown | 8 ++++---- datagrid.gemspec | 2 +- gemfiles/rails_6.1.gemfile | 22 ++++++++++++++++++++++ gemfiles/rails_7.0.gemfile | 22 ++++++++++++++++++++++ gemfiles/rails_7.1.gemfile | 22 ++++++++++++++++++++++ gemfiles/rails_7.2.gemfile | 22 ++++++++++++++++++++++ 12 files changed, 179 insertions(+), 33 deletions(-) create mode 100644 Appraisals create mode 100644 CONTRIBUTING.md create mode 100644 gemfiles/rails_6.1.gemfile create mode 100644 gemfiles/rails_7.0.gemfile create mode 100644 gemfiles/rails_7.1.gemfile create mode 100644 gemfiles/rails_7.2.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb7c428d..b235eb6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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"] + 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 diff --git a/.gitignore b/.gitignore index 11950699..a6a28c09 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,5 @@ wiki .ruby-version .ruby-gemset Gemfile.lock +gemfiles/*.gemfile.lock tmp - diff --git a/Appraisals b/Appraisals new file mode 100644 index 00000000..fe1e44ab --- /dev/null +++ b/Appraisals @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 97d9e0ef..03460356 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d679ba71 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributing to Datagrid + +## 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 +``` diff --git a/Gemfile b/Gemfile index 4fbc1452..3b72ddd4 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Readme.markdown b/Readme.markdown index 5920042e..8a25e9f4 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -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 @@ -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. @@ -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. @@ -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? @@ -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) diff --git a/datagrid.gemspec b/datagrid.gemspec index 0c8ad163..44299c98 100644 --- a/datagrid.gemspec +++ b/datagrid.gemspec @@ -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 diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile new file mode 100644 index 00000000..d92e1f41 --- /dev/null +++ b/gemfiles/rails_6.1.gemfile @@ -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: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile new file mode 100644 index 00000000..92a7e74c --- /dev/null +++ b/gemfiles/rails_7.0.gemfile @@ -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: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 00000000..ab3907f7 --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -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: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 00000000..d1385b02 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -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: "../"