Skip to content

Commit 5fe90c6

Browse files
Workflows / CI: fixed & refactored
## Fixed * Ruby 2.6 (see hotwired/turbo-rails/#681). ## Changed * Moved Rails versions to CI `matrix`. * Both edge and outdated Ruby / Rails versions may fail. * Use the latest RubyGems.
1 parent 93a9bc2 commit 5fe90c6

File tree

3 files changed

+56
-35
lines changed

3 files changed

+56
-35
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,42 @@
22
name: CI
33

44
on:
5-
- push
6-
- pull_request
5+
push:
6+
branches:
7+
- master
8+
pull_request:
79

810
permissions:
911
contents: read
1012

1113
jobs:
1214
rspec:
13-
runs-on: ubuntu-20.04
15+
name: >-
16+
rspec (${{ matrix.ruby }})
17+
18+
runs-on: ubuntu-latest
19+
1420
strategy:
1521
fail-fast: false
1622
matrix:
1723
ruby:
18-
- '3.3'
19-
- '3.2'
20-
- '3.1'
21-
- '3.0'
22-
- '2.7'
23-
- '2.6'
24-
- '2.5'
25-
- '2.4'
24+
- 3.3
25+
- 3.2
26+
- 3.1
27+
rails:
28+
- 6.1 # TODO: move to 7.2
29+
include:
30+
# Edge
31+
- { ruby: 'head', rails: 'edge', allow-fail: true }
32+
# Outdated
33+
- { ruby: '3.0', rails: '6.1' } # TODO: move to 7.1
34+
- { ruby: '2.7', rails: '6' } # RSpec AR Expectations support Rails 7.1 since Ruby 3.0
35+
- { ruby: '2.6', rails: '6' }
36+
- { ruby: '2.5', rails: '6' }
37+
- { ruby: '2.4', rails: '5' }
38+
39+
env:
40+
RAILS_VERSION: "${{ matrix.rails }}"
2641

2742
services:
2843
mongodb:
@@ -31,13 +46,13 @@ jobs:
3146
- 27017:27017
3247

3348
steps:
34-
- name: Checkout
35-
uses: actions/checkout@v4
49+
- uses: actions/checkout@v4
3650

3751
- name: Setup Ruby
3852
uses: ruby/setup-ruby@v1
3953
with:
4054
ruby-version: ${{ matrix.ruby }}
55+
rubygems: latest
4156
bundler-cache: true
4257

4358
- name: RSpec & publish code coverage
@@ -46,3 +61,11 @@ jobs:
4661
CC_TEST_REPORTER_ID: b7ba588af2a540fa96c267b3655a2afe31ea29976dc25905a668dd28d5e88915
4762
with:
4863
coverageCommand: bin/rake
64+
continue-on-error: ${{ matrix.allow-fail }}
65+
id: test
66+
67+
- name: >-
68+
Test ${{ steps.test.outcome }}
69+
run: |
70+
echo Ruby ${{ matrix.ruby }}
71+
echo Rails ${{ matrix.rails }}

Gemfile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ source "https://rubygems.org"
22

33
gemspec
44

5+
gem 'puma'
6+
57
platforms :ruby do
68
if RUBY_VERSION >= "2.5.0"
79
gem 'sqlite3', '~> 1.4'
@@ -15,32 +17,28 @@ platforms :jruby do
1517
gem "activerecord-jdbcsqlite3-adapter"
1618
end
1719

18-
if RUBY_VERSION >= "2.6.0"
19-
gem "turbo-rails"
20-
gem "redis", "~> 4.0"
21-
end
20+
gem 'mongoid'
2221

23-
if RUBY_VERSION >= "2.5.0"
24-
gem "rails", "~> 6.0"
25-
gem 'webrick'
22+
case rails_version = ENV['RAILS_VERSION']
23+
when nil
24+
gem 'rails'
25+
when 'edge'
26+
gem 'rails', github: 'rails/rails'
2627
else
27-
gem "rails", "~> 5.0"
28+
gem 'rails', "~> #{rails_version}.0"
2829
end
2930

30-
if RUBY_VERSION >= "2.7.0"
31-
gem "mongoid", github: "mongodb/mongoid"
32-
elsif RUBY_VERSION >= "2.6.0"
33-
gem "mongoid", "~> 8.1"
34-
else
35-
gem "mongoid", "~> 7.2"
36-
end
37-
38-
if RUBY_VERSION >= "3.1.0"
39-
gem "net-imap"
40-
gem "net-pop"
41-
gem "net-smtp"
31+
case RUBY_VERSION
32+
when '2.6'...'3.0'
33+
gem "turbo-rails", "<= 2.0.7"
34+
gem "redis", "~> 4.0"
35+
when '3.0'...'4'
36+
gem 'turbo-rails'
37+
gem 'redis', '~> 4.0'
4238
end
4339

4440
if RUBY_VERSION < "2.5.0"
41+
gem 'rspec-activerecord-expectations', '~> 1.2.0'
42+
gem 'simplecov', '0.17.1'
4543
gem "loofah", "< 2.21.0" # Workaround for `uninitialized constant Nokogiri::HTML4`
4644
end

draper.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
2626
s.add_development_dependency 'ammeter'
2727
s.add_development_dependency 'rake'
2828
s.add_development_dependency 'rspec-rails'
29-
s.add_development_dependency 'rspec-activerecord-expectations', '~> 1.2.0'
29+
s.add_development_dependency 'rspec-activerecord-expectations'
3030
s.add_development_dependency 'minitest-rails'
3131
s.add_development_dependency 'capybara'
3232
s.add_development_dependency 'active_model_serializers', '>= 0.10'
3333
s.add_development_dependency 'rubocop'
34-
s.add_development_dependency 'simplecov', '0.17.1'
34+
s.add_development_dependency 'simplecov'
3535
end

0 commit comments

Comments
 (0)