Skip to content

Commit

Permalink
test(deps): use appraisals for multi-version test runs (#17)
Browse files Browse the repository at this point in the history
* ci: set max ruby version to 3.1

* chore: add appraisals gem
  • Loading branch information
rdsngit authored May 23, 2023
1 parent 689e9de commit 62f2d56
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 11 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
steps:
- name: Install system dependencies
run: |
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
## Ignore project generated files
.lock*

## Ignore gemfiles generated by appraisal gem
gemfiles

## Ignore lock file
Gemfile.lock
19 changes: 19 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'
gemspec
group :development do
gem 'appraisal', '~> 2.4'
gem 'rspec'
gem 'sqlite3'
end
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 62f2d56

Please sign in to comment.