Skip to content

Commit

Permalink
Add testing infrastructure
Browse files Browse the repository at this point in the history
This adds testing infrastructure to test against multiple versions of
Rails, including Rails `main` branch.
  • Loading branch information
jonathanhefner committed Dec 3, 2023
1 parent bdbc46a commit 6d076d2
Show file tree
Hide file tree
Showing 16 changed files with 1,088 additions and 47 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI
on: [push, pull_request]
jobs:
tests:
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.0"
- "3.1"
- "3.2"
gemfile:
- Gemfile
- gemfiles/rails_7_0_propshaft.gemfile
- gemfiles/rails_7_1_propshaft.gemfile
- gemfiles/rails_main_propshaft.gemfile
- gemfiles/rails_7_0_sprockets.gemfile
- gemfiles/rails_7_1_sprockets.gemfile
- gemfiles/rails_main_sprockets.gemfile
continue-on-error: [ false ]

name: ${{ format('Tests (Ruby {0}, {1})', matrix.ruby-version, matrix.gemfile) }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.continue-on-error }}

env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

steps:
- uses: actions/checkout@v4

- name: Remove Gemfile lock
run: |
rm -f $BUNDLE_GEMFILE.lock
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

# This prevents a "Failed to build gem native extension" error when
# running `bundle install` inside a Rails app that is generated for
# testing. The error occurs only in CI, and only when using Ruby 3.0 and
# Rails >= 7.1.
- name: Install sass-embedded gem
if: ${{ matrix.ruby-version == '3.0' }}
run: gem install sass-embedded

- name: Run tests
run: |
bundle exec rake
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
.idea/
**/tmp/
/exe/*/tailwindcss

# Ignore Gemfile.lock files for Rails main branch.
/gemfiles/rails_main*.gemfile.lock
29 changes: 29 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
appraise "rails_7_0_sprockets" do
gem "rails", "~> 7.0.0"
gem "sprockets-rails"
end

appraise "rails_7_0_propshaft" do
gem "rails", "~> 7.0.0"
gem "propshaft"
end

appraise "rails_7_1_sprockets" do
gem "rails", "~> 7.1.0"
gem "sprockets-rails"
end

appraise "rails_7_1_propshaft" do
gem "rails", "~> 7.1.0"
gem "propshaft"
end

appraise "rails_main_sprockets" do
gem "rails", github: "rails/rails", branch: "main"
gem "sprockets-rails"
end

appraise "rails_main_propshaft" do
gem "rails", github: "rails/rails", branch: "main"
gem "propshaft"
end
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gemspec

gem "appraisal"
gem "rails", "~> 6.1.0"
gem "sqlite3"
gem "debug", ">= 1.0.0"

group :test do
gem "actionmailer", ">= 6.0.0"
end
164 changes: 121 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,96 +8,174 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionmailer (6.1.4.1)
actionpack (= 6.1.4.1)
actionview (= 6.1.4.1)
activejob (= 6.1.4.1)
activesupport (= 6.1.4.1)
actioncable (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
mail (>= 2.7.1)
actionmailer (6.1.7.6)
actionpack (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activesupport (= 6.1.7.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.4.1)
actionview (= 6.1.4.1)
activesupport (= 6.1.4.1)
actionpack (6.1.7.6)
actionview (= 6.1.7.6)
activesupport (= 6.1.7.6)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (6.1.4.1)
activesupport (= 6.1.4.1)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
nokogiri (>= 1.8.5)
actionview (6.1.7.6)
activesupport (= 6.1.7.6)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4.1)
activesupport (= 6.1.4.1)
activejob (6.1.7.6)
activesupport (= 6.1.7.6)
globalid (>= 0.3.6)
activesupport (6.1.4.1)
activemodel (6.1.7.6)
activesupport (= 6.1.7.6)
activerecord (6.1.7.6)
activemodel (= 6.1.7.6)
activesupport (= 6.1.7.6)
activestorage (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activesupport (= 6.1.7.6)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
builder (3.2.4)
concurrent-ruby (1.1.9)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.4)
debug (1.1.0)
irb
reline (>= 0.2.7)
erubi (1.10.0)
globalid (1.0.0)
activesupport (>= 5.0)
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (3.23.3)
i18n (1.8.11)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.5.9)
irb (1.3.7)
reline (>= 0.2.7)
loofah (2.12.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
minitest (5.14.4)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
net-imap (0.4.7)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
racc (1.6.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
racc (1.7.3)
rack (2.2.8)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.6)
actioncable (= 6.1.7.6)
actionmailbox (= 6.1.7.6)
actionmailer (= 6.1.7.6)
actionpack (= 6.1.7.6)
actiontext (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activemodel (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
bundler (>= 1.15.0)
railties (= 6.1.7.6)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.4.1)
actionpack (= 6.1.4.1)
activesupport (= 6.1.4.1)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
method_source
rake (>= 0.13)
rake (>= 12.2)
thor (~> 1.0)
rake (13.0.6)
rake (13.1.0)
reline (0.2.7)
io-console (~> 0.5)
sass-embedded (1.63.4)
google-protobuf (~> 3.23)
rake (>= 13.0.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.4.2)
thor (1.2.2)
tzinfo (2.0.4)
thor (1.3.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
zeitwerk (2.5.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.12)

PLATFORMS
ruby

DEPENDENCIES
actionmailer (>= 6.0.0)
appraisal
dartsass-rails!
debug (>= 1.0.0)
rails (~> 6.1.0)
sqlite3

BUNDLED WITH
Expand Down
11 changes: 11 additions & 0 deletions gemfiles/rails_7_0_propshaft.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rails", "~> 7.0.0"
gem "sqlite3"
gem "debug", ">= 1.0.0"
gem "propshaft"

gemspec path: "../"
Loading

0 comments on commit 6d076d2

Please sign in to comment.