Skip to content

Commit e126517

Browse files
petergoldsteinremear
authored andcommitted
Migrate CI to GitHub Actions
Adds a number of more recent Ruby and Rails versions Loosens the restrictions in the gemspec to enable those more recent versions to bundle Makes minor changes to the dummy Rails app to allow it to work with Rails 7 Conditionally explicitly includes the net-* mail gems for the Ruby 3.1 / Rails 6.1.x combination
1 parent 163f371 commit e126517

File tree

6 files changed

+80
-7
lines changed

6 files changed

+80
-7
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
ruby: [3.1, '3.0', 2.7, 2.6, ruby-head]
14+
rails: ['7.0.0', '6.1.0', '6.0.0', '5.2.0', main]
15+
exclude:
16+
- ruby: ruby-head
17+
rails: '6.1.0'
18+
- ruby: ruby-head
19+
rails: '6.0.0'
20+
- ruby: ruby-head
21+
rails: '5.2.0'
22+
- ruby: 3.1
23+
rails: '6.0.0'
24+
- ruby: 3.1
25+
rails: '5.2.0'
26+
- ruby: 3.0
27+
rails: main
28+
- ruby: 3.0
29+
rails: '6.0.0'
30+
- ruby: 3.0
31+
rails: '5.2.0'
32+
- ruby: 2.7
33+
rails: main
34+
- ruby: 2.7
35+
rails: '5.2.0'
36+
- ruby: 2.6
37+
rails: main
38+
- ruby: 2.6
39+
rails: '7.0.0'
40+
- ruby: 2.6
41+
rails: '6.1.0'
42+
- ruby: 2.6
43+
rails: '6.0.0'
44+
45+
env:
46+
RAILS_VERSION: ${{ matrix.rails }}
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Set up Ruby ${{ matrix.ruby }}
51+
uses: ruby/setup-ruby@v1
52+
with:
53+
ruby-version: ${{ matrix.ruby }}
54+
bundler-cache: true # 'bundle install' and cache
55+
- name: Run tests
56+
run: bundle exec rake

Gemfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33
rails_version = ENV['RAILS_VERSION'] || "default"
44
rails =
55
case rails_version
6-
when 'master'
6+
when 'main'
77
{ github: 'rails/rails' }
88
when 'default'
99
'>= 5.0'
@@ -13,4 +13,12 @@ rails =
1313

1414
gem 'rails', rails
1515

16+
# Required for Rails 6.1.x with Ruby 3.1+
17+
if RUBY_VERSION >= '3.1'
18+
gem 'net-smtp', require: false
19+
gem 'net-imap', require: false
20+
gem 'net-pop', require: false
21+
end
22+
23+
1624
gemspec

jsonapi-rails.gemspec

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ Gem::Specification.new do |spec|
1717
spec.add_dependency 'jsonapi-rb', '~> 0.5.0'
1818
spec.add_dependency 'jsonapi-parser', '~> 0.1.0'
1919

20-
spec.add_development_dependency 'rails', '~> 5.0'
21-
spec.add_development_dependency 'sqlite3', '~> 1.3'
22-
spec.add_development_dependency 'rake', '~> 11.3'
20+
spec.add_development_dependency 'rails', '>= 5.0'
21+
spec.add_development_dependency 'sqlite3', '>= 1.3'
22+
spec.add_development_dependency 'rake', '>= 11.3'
2323
spec.add_development_dependency 'rspec-rails', '~> 3.5'
2424
spec.add_development_dependency 'with_model', '~> 2.0'
2525
spec.add_development_dependency 'simplecov'
26-
spec.add_development_dependency 'pry-byebug'
2726
end

spec/dummy/config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# test suite. You never need to work with it otherwise. Remember that
66
# your test database is "scratch space" for the test suite and is wiped
77
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
8+
config.cache_classes = false
99

1010
# Do not eager load code on boot. This avoids loading your whole application
1111
# just for the purpose of running a single test. If you are using a tool that

spec/dummy/config/initializers/assets.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Version of your assets, change this if you want to expire all your assets.
4-
Rails.application.config.assets.version = '1.0'
4+
if Rails.application.config.respond_to?(:assets)
5+
Rails.application.config.assets.version = '1.0'
6+
end
57

68
# Add additional assets to the asset load path
79
# Rails.application.config.assets.paths << Emoji.images_path

spec/dummy/config/storage.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
test:
2+
service: Disk
3+
root: <%= Rails.root.join("tmp/storage") %>
4+
5+
local:
6+
service: Disk
7+
root: <%= Rails.root.join("storage") %>
8+

0 commit comments

Comments
 (0)