Skip to content

Commit

Permalink
Merge pull request #75 from jcypret/add-rails-matrix-testing
Browse files Browse the repository at this point in the history
Add testing matrix for supported Rails versions
  • Loading branch information
jcypret authored Aug 10, 2020
2 parents 6979df2 + 306b8c7 commit 54afc08
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ on: [push, pull_request]

jobs:
build:
name: Ruby ${{ matrix.ruby }}
name: Ruby ${{ matrix.ruby }} on Rails ${{ matrix.rails }}
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["2.5", "2.6", "2.7"]
ruby: ["2.5", "2.6"]
rails: ["4.2", "5.0", "5.1", "5.2", "6.0"]
include:
- ruby: "2.7"
rails: "6.0"

steps:
- uses: actions/checkout@v2
Expand All @@ -25,17 +29,19 @@ jobs:
uses: actions/cache@v2
with:
path: vendor/bundle
key: ruby-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
key: ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}-gems-${{ hashFiles('hashid-rails.gemspec', 'Appraisals') }}
restore-keys: |
ruby-${{ matrix.ruby }}-gems-
ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}-gems-
- name: Install Ruby dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle config set path ../vendor/bundle
bundle install --gemfile gemfiles/rails_${{ matrix.rails }}.gemfile --jobs 4 --retry 3
- name: Test with RSpec
run: bundle exec rspec
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
run: bundle exec appraisal rails-${{ matrix.rails }} rspec

- name: Publish Test Coverage
uses: paambaati/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/spec/reports/
/tmp/
/.ruby-version
*.gemfile.lock
23 changes: 23 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

appraise "rails-4.2" do
gem "activerecord", "~> 4.2.0"
gem "sqlite3", "< 1.4"
end

appraise "rails-5.0" do
gem "activerecord", "~> 5.0.0"
gem "sqlite3", "< 1.4"
end

appraise "rails-5.1" do
gem "activerecord", "~> 5.1.0"
end

appraise "rails-5.2" do
gem "activerecord", "~> 5.2.0"
end

appraise "rails-6.0" do
gem "activerecord", "~> 6.0.0"
end
8 changes: 8 additions & 0 deletions gemfiles/rails_4.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 4.2.0"
gem "sqlite3", "< 1.4"

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

source "https://rubygems.org"

gem "activerecord", "~> 5.0.0"
gem "sqlite3", "< 1.4"

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

source "https://rubygems.org"

gem "activerecord", "~> 5.1.0"

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

source "https://rubygems.org"

gem "activerecord", "~> 5.2.0"

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

source "https://rubygems.org"

gem "activerecord", "~> 6.0.0"

gemspec path: "../"
1 change: 1 addition & 0 deletions hashid-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "appraisal"
spec.add_development_dependency "bundler"
spec.add_development_dependency "byebug"
spec.add_development_dependency "rake"
Expand Down

0 comments on commit 54afc08

Please sign in to comment.