Skip to content

Commit

Permalink
Test installer commands (#182)
Browse files Browse the repository at this point in the history
* Add testing infrastructure

This adds testing infrastructure to test against multiple versions of
Rails, including Rails `main` branch.

* Test shared behavior of installer commands

This adds test coverage for the shared behavior of the installer
commands.  The commands are tested against a freshly generated Rails app
using the version of Rails that is currently loaded.  Thus the
installers can be tested with different versions of Rails in CI.

* Test specific behavior of javascript:install:bun

This adds test coverage for specific behavior of the
`javascript:install:bun` command.

* Test specific behavior of javascript:install:esbuild

This adds test coverage for specific behavior of the
`javascript:install:esbuild` command.

* Test specific behavior of javascript:install:rollup

This adds test coverage for specific behavior of the
`javascript:install:rollup` command.

* Test specific behavior of javascript:install:webpack

This adds test coverage for specific behavior of the
`javascript:install:webpack` command.
  • Loading branch information
jonathanhefner authored Jul 29, 2024
1 parent 38fbbae commit 7054254
Show file tree
Hide file tree
Showing 17 changed files with 1,066 additions and 116 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI
on: [push, pull_request]
jobs:
tests:
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.1"
- "3.2"
- "3.3"
gemfile:
- gemfiles/rails_7_0.gemfile
- gemfiles/rails_7_1.gemfile
- gemfiles/rails_main.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

- name: Run tests
run: |
bundle exec rake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/tmp/
.byebug_history
*.gem

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

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

appraise "rails_main" do
gem "rails", github: "rails/rails", branch: "main"
gem "propshaft"
end
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Specify your gem's dependencies in importmap-rails.gemspec.
gemspec

rails_version = ENV["RAILS_VERSION"] || "6.1.0"
gem "rails", "~> #{rails_version}"

gem "appraisal"
gem "rails", "~> 6.0.0"
gem "sprockets-rails"
gem "sqlite3"

group :test do
Expand Down
257 changes: 144 additions & 113 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,162 +7,191 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
actioncable (6.0.6.1)
actionpack (= 6.0.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
actionmailbox (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
mail (>= 2.7.1)
actionmailer (6.1.3.1)
actionpack (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activesupport (= 6.1.3.1)
actionmailer (6.0.6.1)
actionpack (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.3.1)
actionview (= 6.1.3.1)
activesupport (= 6.1.3.1)
rack (~> 2.0, >= 2.0.9)
actionpack (6.0.6.1)
actionview (= 6.0.6.1)
activesupport (= 6.0.6.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.3.1)
actionpack (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
actiontext (6.0.6.1)
actionpack (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
nokogiri (>= 1.8.5)
actionview (6.1.3.1)
activesupport (= 6.1.3.1)
actionview (6.0.6.1)
activesupport (= 6.0.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.3.1)
activesupport (= 6.1.3.1)
activejob (6.0.6.1)
activesupport (= 6.0.6.1)
globalid (>= 0.3.6)
activemodel (6.1.3.1)
activesupport (= 6.1.3.1)
activerecord (6.1.3.1)
activemodel (= 6.1.3.1)
activesupport (= 6.1.3.1)
activestorage (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activesupport (= 6.1.3.1)
marcel (~> 1.0.0)
mini_mime (~> 1.0.2)
activesupport (6.1.3.1)
activemodel (6.0.6.1)
activesupport (= 6.0.6.1)
activerecord (6.0.6.1)
activemodel (= 6.0.6.1)
activesupport (= 6.0.6.1)
activestorage (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
marcel (~> 1.0)
activesupport (6.0.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.35.3)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (3.0.0)
concurrent-ruby (1.1.9)
concurrent-ruby (1.2.2)
crass (1.0.6)
erubi (1.10.0)
globalid (0.5.1)
date (3.3.4)
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.8.10)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
loofah (2.10.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)
marcel (1.0.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.0.3)
mini_portile2 (2.8.2)
minitest (5.14.4)
nio4r (2.5.7)
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
mini_mime (1.1.5)
minitest (5.20.0)
net-imap (0.4.9.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0-aarch64-linux)
racc (~> 1.4)
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.3.1)
actioncable (= 6.1.3.1)
actionmailbox (= 6.1.3.1)
actionmailer (= 6.1.3.1)
actionpack (= 6.1.3.1)
actiontext (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activemodel (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
bundler (>= 1.15.0)
railties (= 6.1.3.1)
nokogiri (1.16.0-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.0-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.0-x86_64-linux)
racc (~> 1.4)
public_suffix (5.0.4)
racc (1.7.3)
rack (2.2.8)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.0.6.1)
actioncable (= 6.0.6.1)
actionmailbox (= 6.0.6.1)
actionmailer (= 6.0.6.1)
actionpack (= 6.0.6.1)
actiontext (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
activemodel (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
bundler (>= 1.3.0)
railties (= 6.0.6.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.0.6.1)
actionpack (= 6.0.6.1)
activesupport (= 6.0.6.1)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
thor (>= 0.20.3, < 2.0)
rake (13.1.0)
regexp_parser (2.9.0)
rexml (3.2.6)
rubyzip (2.3.2)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sprockets (4.0.2)
selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.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)
stimulus-rails (0.3.8)
rails (>= 6.0.0)
thor (1.1.0)
turbo-rails (0.7.4)
rails (>= 6.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
webdrivers (4.6.0)
sqlite3 (1.7.0-aarch64-linux)
sqlite3 (1.7.0-arm64-darwin)
sqlite3 (1.7.0-x86_64-darwin)
sqlite3 (1.7.0-x86_64-linux)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
thor (1.3.0)
thread_safe (0.3.6)
timeout (0.4.1)
turbo-rails (1.5.0)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (1.2.11)
thread_safe (~> 0.1)
webdrivers (5.3.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
websocket-driver (0.7.5)
selenium-webdriver (~> 4.0, < 4.11)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
zeitwerk (2.6.12)

PLATFORMS
aarch64-linux
Expand All @@ -174,12 +203,14 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
appraisal
byebug
capybara
jsbundling-rails!
rails (~> 6.1.0)
rails (~> 6.0.0)
rexml
selenium-webdriver
sprockets-rails
sqlite3
stimulus-rails
turbo-rails
Expand Down
Loading

0 comments on commit 7054254

Please sign in to comment.