Skip to content

Commit 2413e21

Browse files
Test installer commands (retry) (#197)
* 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.
1 parent 6ead108 commit 2413e21

19 files changed

+1196
-16
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
tests:
5+
strategy:
6+
fail-fast: false
7+
matrix:
8+
ruby-version:
9+
- "3.1"
10+
- "3.2"
11+
- "3.3"
12+
gemfile:
13+
- gemfiles/rails_6_1.gemfile
14+
- gemfiles/rails_7_0.gemfile
15+
- gemfiles/rails_7_1.gemfile
16+
- gemfiles/rails_main.gemfile
17+
continue-on-error: [ false ]
18+
19+
name: ${{ format('Tests (Ruby {0}, {1})', matrix.ruby-version, matrix.gemfile) }}
20+
runs-on: ubuntu-latest
21+
continue-on-error: ${{ matrix.continue-on-error }}
22+
23+
env:
24+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Remove Gemfile lock
30+
run: |
31+
rm -f $BUNDLE_GEMFILE.lock
32+
33+
- name: Install Ruby
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: ${{ matrix.ruby-version }}
37+
bundler-cache: true
38+
39+
- name: Run tests
40+
run: |
41+
bundle exec rake

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
/tmp/
12
.byebug_history
23
*.gem
4+
5+
# Ignore Gemfile.lock files for Rails main branch.
6+
/gemfiles/rails_main*.gemfile.lock

Appraisals

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
appraise "rails_6_1" do
2+
gem "rails", "~> 6.1.0"
3+
end
4+
5+
appraise "rails_7_0" do
6+
gem "rails", "~> 7.0.0"
7+
gem "propshaft"
8+
end
9+
10+
appraise "rails_7_1" do
11+
gem "rails", "~> 7.1.0"
12+
gem "propshaft"
13+
end
14+
15+
appraise "rails_main" do
16+
gem "rails", github: "rails/rails", branch: "main"
17+
gem "propshaft"
18+
end

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
44
# Specify your gem's dependencies in importmap-rails.gemspec.
55
gemspec
66

7-
rails_version = ENV["RAILS_VERSION"] || "6.1.0"
8-
gem "rails", "~> #{rails_version}"
9-
7+
gem "appraisal"
8+
gem "rails", "~> 6.1.0"
9+
gem "sprockets-rails"
1010
gem "sqlite3"
1111

1212
group :test do

Gemfile.lock

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ GEM
6868
zeitwerk (~> 2.3)
6969
addressable (2.8.7)
7070
public_suffix (>= 2.0.2, < 7.0)
71+
appraisal (2.5.0)
72+
bundler
73+
rake
74+
thor (>= 0.14.0)
7175
builder (3.3.0)
7276
byebug (11.1.3)
7377
capybara (3.40.0)
@@ -112,14 +116,18 @@ GEM
112116
nio4r (2.7.3)
113117
nokogiri (1.16.7-aarch64-linux)
114118
racc (~> 1.4)
119+
nokogiri (1.16.7-arm-linux)
120+
racc (~> 1.4)
115121
nokogiri (1.16.7-arm64-darwin)
116122
racc (~> 1.4)
123+
nokogiri (1.16.7-x86-linux)
124+
racc (~> 1.4)
117125
nokogiri (1.16.7-x86_64-darwin)
118126
racc (~> 1.4)
119127
nokogiri (1.16.7-x86_64-linux)
120128
racc (~> 1.4)
121129
public_suffix (6.0.1)
122-
racc (1.8.0)
130+
racc (1.8.1)
123131
rack (2.2.9)
124132
rack-test (2.1.0)
125133
rack (>= 1.3)
@@ -167,10 +175,16 @@ GEM
167175
actionpack (>= 6.1)
168176
activesupport (>= 6.1)
169177
sprockets (>= 3.0.0)
170-
sqlite3 (2.0.2-aarch64-linux-gnu)
171-
sqlite3 (2.0.2-arm64-darwin)
172-
sqlite3 (2.0.2-x86_64-darwin)
173-
sqlite3 (2.0.2-x86_64-linux-gnu)
178+
sqlite3 (2.0.3-aarch64-linux-gnu)
179+
sqlite3 (2.0.3-aarch64-linux-musl)
180+
sqlite3 (2.0.3-arm-linux-gnu)
181+
sqlite3 (2.0.3-arm-linux-musl)
182+
sqlite3 (2.0.3-arm64-darwin)
183+
sqlite3 (2.0.3-x86-linux-gnu)
184+
sqlite3 (2.0.3-x86-linux-musl)
185+
sqlite3 (2.0.3-x86_64-darwin)
186+
sqlite3 (2.0.3-x86_64-linux-gnu)
187+
sqlite3 (2.0.3-x86_64-linux-musl)
174188
stimulus-rails (1.3.3)
175189
railties (>= 6.0.0)
176190
strscan (3.1.0)
@@ -192,28 +206,36 @@ GEM
192206
websocket-extensions (0.1.5)
193207
xpath (3.2.0)
194208
nokogiri (~> 1.8)
195-
zeitwerk (2.6.16)
209+
zeitwerk (2.6.17)
196210

197211
PLATFORMS
198212
aarch64-linux
199-
arm64-darwin-20
200-
arm64-darwin-21
201-
arm64-darwin-22
202-
x86_64-darwin-20
203-
x86_64-darwin-21
204-
x86_64-linux
213+
aarch64-linux-gnu
214+
aarch64-linux-musl
215+
arm-linux
216+
arm-linux-gnu
217+
arm-linux-musl
218+
arm64-darwin
219+
x86-linux
220+
x86-linux-gnu
221+
x86-linux-musl
222+
x86_64-darwin
223+
x86_64-linux-gnu
224+
x86_64-linux-musl
205225

206226
DEPENDENCIES
227+
appraisal
207228
byebug
208229
capybara
209230
jsbundling-rails!
210231
rails (~> 6.1.0)
211232
rexml
212233
selenium-webdriver
234+
sprockets-rails
213235
sqlite3
214236
stimulus-rails
215237
turbo-rails
216238
webdrivers
217239

218240
BUNDLED WITH
219-
2.3.8
241+
2.5.16

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require "bundler/setup"
2+
require "bundler/gem_tasks"
3+
require "rake/testtask"
4+
5+
Rake::TestTask.new(:test) do |t|
6+
t.libs << "test"
7+
t.pattern = "test/**/*_test.rb"
8+
end
9+
10+
task default: :test

gemfiles/rails_6_1.gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "appraisal"
6+
gem "rails", "~> 6.1.0"
7+
gem "sprockets-rails"
8+
gem "sqlite3"
9+
10+
group :test do
11+
gem "turbo-rails"
12+
gem "stimulus-rails"
13+
gem "byebug"
14+
gem "rexml"
15+
gem "capybara"
16+
gem "selenium-webdriver"
17+
gem "webdrivers"
18+
end
19+
20+
gemspec path: "../"

0 commit comments

Comments
 (0)