diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04d5ebf..76c7329 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ jobs: - "2.7" - "3.0" - "3.1" - - "3.2" steps: - name: Install system dependencies run: | @@ -23,9 +22,9 @@ jobs: ruby-version: ${{ matrix.ruby_version }} bundler-cache: true - name: Install dependencies - run: bundle install + run: bundle install && bundle exec appraisal install - name: Run Tests - run: bundle exec rspec + run: bundle exec appraisal rspec release-please: name: Release Please @@ -50,7 +49,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 + ruby-version: 3.1 - name: Build Gem run: gem build *.gemspec - name: Setup credentials diff --git a/.gitignore b/.gitignore index a0dc88f..ee14bbd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,8 @@ ## Ignore project generated files .lock* +## Ignore gemfiles generated by appraisal gem +gemfiles + ## Ignore lock file Gemfile.lock diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..3897b53 --- /dev/null +++ b/Appraisals @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0') + appraise 'activerecord-5-2' do + gem 'activerecord', '~> 5.2.0' + end +end + +appraise 'activerecord-6-0' do + gem 'activerecord', '~> 6.0.0' +end + +appraise 'activerecord-6-1' do + gem 'activerecord', '~> 6.1.0' +end + +appraise 'activerecord-7-0' do + gem 'activerecord', '~> 7.0.0' +end diff --git a/Gemfile b/Gemfile index 34db348..af83767 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' gemspec group :development do + gem 'appraisal', '~> 2.4' gem 'rspec' gem 'sqlite3' end diff --git a/README.md b/README.md index 99b0cd7..6aac194 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,20 @@ Metricks is an ActiveRecord-powered backend for storing historical numeric metri The library provides the tools to define multiple types of metrics, record them in the database as well as providing tools to aggregate the results and run comparisons on different time periods. -## Supported Ruby and Ruby on Rails versions +## Supported Ruby and Active Record versions Supported Ruby versions include: - 2.7 - 3.0 - 3.1 -- 3.2 -Supported Ruby on Rails versions include: +Supported Active Record versions include: -- 5 -- 6 -- 7 +- 5.2 +- 6.0 +- 6.1 +- 7.0 ## Installation diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 468a9d1..de5bc27 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,12 @@ require 'active_record' ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' -ActiveRecord::MigrationContext.new(File.expand_path('../db/migrate', __dir__)).migrate + +if ActiveRecord::VERSION::MAJOR == 6 + ActiveRecord::MigrationContext.new(File.expand_path('../db/migrate', __dir__), ActiveRecord::SchemaMigration).migrate +else + ActiveRecord::MigrationContext.new(File.expand_path('../db/migrate', __dir__)).migrate +end require 'metricks' require_relative './example_types'