Skip to content

Commit

Permalink
Test installer commands (retry) (#197)
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 31, 2024
1 parent 6ead108 commit 2413e21
Show file tree
Hide file tree
Showing 19 changed files with 1,196 additions and 16 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on: [push, pull_request]
jobs:
tests:
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.1"
- "3.2"
- "3.3"
gemfile:
- gemfiles/rails_6_1.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
18 changes: 18 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
appraise "rails_6_1" do
gem "rails", "~> 6.1.0"
end

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.1.0"
gem "sprockets-rails"
gem "sqlite3"

group :test do
Expand Down
48 changes: 35 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
builder (3.3.0)
byebug (11.1.3)
capybara (3.40.0)
Expand Down Expand Up @@ -112,14 +116,18 @@ GEM
nio4r (2.7.3)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
public_suffix (6.0.1)
racc (1.8.0)
racc (1.8.1)
rack (2.2.9)
rack-test (2.1.0)
rack (>= 1.3)
Expand Down Expand Up @@ -167,10 +175,16 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (2.0.2-aarch64-linux-gnu)
sqlite3 (2.0.2-arm64-darwin)
sqlite3 (2.0.2-x86_64-darwin)
sqlite3 (2.0.2-x86_64-linux-gnu)
sqlite3 (2.0.3-aarch64-linux-gnu)
sqlite3 (2.0.3-aarch64-linux-musl)
sqlite3 (2.0.3-arm-linux-gnu)
sqlite3 (2.0.3-arm-linux-musl)
sqlite3 (2.0.3-arm64-darwin)
sqlite3 (2.0.3-x86-linux-gnu)
sqlite3 (2.0.3-x86-linux-musl)
sqlite3 (2.0.3-x86_64-darwin)
sqlite3 (2.0.3-x86_64-linux-gnu)
sqlite3 (2.0.3-x86_64-linux-musl)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
strscan (3.1.0)
Expand All @@ -192,28 +206,36 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.16)
zeitwerk (2.6.17)

PLATFORMS
aarch64-linux
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-20
x86_64-darwin-21
x86_64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

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

BUNDLED WITH
2.3.8
2.5.16
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "bundler/setup"
require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end

task default: :test
20 changes: 20 additions & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was generated by Appraisal

source "https://rubygems.org"

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

group :test do
gem "turbo-rails"
gem "stimulus-rails"
gem "byebug"
gem "rexml"
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end

gemspec path: "../"
Loading

0 comments on commit 2413e21

Please sign in to comment.