Skip to content

Commit 7e3273d

Browse files
authored
Add Appraisal (#28)
1 parent 885637a commit 7e3273d

10 files changed

Lines changed: 115 additions & 27 deletions

File tree

.github/workflows/main.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,24 @@ jobs:
1616
- name: Install Ruby and gems
1717
uses: ruby/setup-ruby@v1
1818
with:
19-
ruby-version: 3.4.7
19+
ruby-version: 3.4
2020
bundler-cache: true
2121

2222
- name: Run Rubocop
2323
run: bin/rubocop
2424

2525
test:
2626
runs-on: ubuntu-latest
27-
name: Ruby ${{ matrix.ruby }}
27+
name: Ruby ${{ matrix.ruby }} (${{ matrix.appraisal }})
2828
strategy:
2929
matrix:
30-
ruby:
31-
- "3.1.7"
32-
- "3.2.9"
33-
- "3.3.10"
34-
- "3.4.7"
30+
ruby: ["3.1", "3.2", "3.3", "3.4"]
31+
appraisal: ["rails_7.1", "rails_7.2", "rails_8.0", "rails_8.1"]
32+
exclude:
33+
- ruby: "3.1"
34+
appraisal: "rails_8.0"
35+
- ruby: "3.1"
36+
appraisal: "rails_8.1"
3537
services:
3638
postgres:
3739
image: postgres:17
@@ -49,21 +51,26 @@ jobs:
4951
env:
5052
RAILS_ENV: test
5153
CI: true
54+
# Use absolute path for BUNDLE_GEMFILE to avoid issues with relative path resolution
55+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.appraisal }}.gemfile
5256
steps:
53-
- name: Checkout code
54-
uses: actions/checkout@v4
57+
- name: Checkout code
58+
uses: actions/checkout@v4
5559

56-
- name: Install Ruby and gems
57-
uses: ruby/setup-ruby@v1
58-
with:
59-
ruby-version: ${{ matrix.ruby }}
60-
bundler-cache: true
60+
- name: Install Ruby and gems
61+
uses: ruby/setup-ruby@v1
62+
with:
63+
ruby-version: ${{ matrix.ruby }}
64+
bundler-cache: true
6165

62-
- name: Set up Dummy
63-
run: spec/dummy/bin/setup
66+
- name: Set up Dummy
67+
run: spec/dummy/bin/setup
6468

65-
- name: Run tests
66-
run: bin/rspec
69+
- name: Run tests
70+
run: bin/rspec
6771

68-
- name: Run tests with customization
69-
run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/rspec
72+
- name: Run tests with customization
73+
run: bin/rspec
74+
env:
75+
CHANGE_FIELD_BASE_CLASS: true
76+
CHANGE_VALUE_CLASS: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020

2121
.ruby-version
2222
Gemfile.lock
23+
gemfiles/*.lock
2324
TODO.md

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ AllCops:
1414
TargetRailsVersion: 8.1
1515
NewCops: enable
1616
Exclude:
17+
- "gemfiles/*"
1718
- "spec/dummy/db/schema.rb"
1819

1920
Layout/LineLength:

Appraisals

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
# See https://github.com/thoughtbot/appraisal for more information.
4+
5+
appraise "rails_7.1" do
6+
gem "rails", "~> 7.1.0"
7+
end
8+
9+
appraise "rails_7.2" do
10+
gem "rails", "~> 7.2.0"
11+
end
12+
13+
appraise "rails_8.0" do
14+
gem "rails", "~> 8.0.0"
15+
end
16+
17+
appraise "rails_8.1" do
18+
gem "rails", "~> 8.1.0"
19+
end

active_fields.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
3333
# Dependencies
3434
spec.add_dependency "rails", ">= 7.1"
3535

36+
spec.add_development_dependency "appraisal"
3637
spec.add_development_dependency "factory_bot"
3738
spec.add_development_dependency "pg"
3839
spec.add_development_dependency "rake"

gemfiles/rails_7.1.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "puma"
6+
gem "propshaft"
7+
gem "importmap-rails"
8+
gem "stimulus-rails"
9+
gem "rails", "~> 7.1.0"
10+
11+
group :development do
12+
gem "web-console"
13+
end
14+
15+
gemspec path: "../"

gemfiles/rails_7.2.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "puma"
6+
gem "propshaft"
7+
gem "importmap-rails"
8+
gem "stimulus-rails"
9+
gem "rails", "~> 7.2.0"
10+
11+
group :development do
12+
gem "web-console"
13+
end
14+
15+
gemspec path: "../"

gemfiles/rails_8.0.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "puma"
6+
gem "propshaft"
7+
gem "importmap-rails"
8+
gem "stimulus-rails"
9+
gem "rails", "~> 8.0.0"
10+
11+
group :development do
12+
gem "web-console"
13+
end
14+
15+
gemspec path: "../"

gemfiles/rails_8.1.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "puma"
6+
gem "propshaft"
7+
gem "importmap-rails"
8+
gem "stimulus-rails"
9+
gem "rails", "~> 8.1.0"
10+
11+
group :development do
12+
gem "web-console"
13+
end
14+
15+
gemspec path: "../"

spec/dummy/bin/setup

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ FileUtils.chdir APP_ROOT do
1616
# Add necessary setup steps to this file.
1717

1818
puts "== Installing dependencies =="
19-
system! "gem install bundler --conservative"
2019
system("bundle check") || system!("bundle install")
2120

2221
# puts "\n== Copying sample files =="
@@ -26,14 +25,14 @@ FileUtils.chdir APP_ROOT do
2625

2726
puts "\n== Preparing database =="
2827
system! "bin/rails db:prepare"
28+
system! "bin/rails db:reset" if ARGV.include?("--reset")
2929

3030
puts "\n== Removing old logs and tempfiles =="
3131
system! "bin/rails log:clear tmp:clear"
3232

33-
puts "\n== Restarting application server =="
34-
system! "bin/rails restart"
35-
36-
# puts "\n== Configuring puma-dev =="
37-
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
38-
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
33+
# unless ARGV.include?("--skip-server")
34+
# puts "\n== Starting development server =="
35+
# STDOUT.flush # flush the output before exec(2) so that it displays
36+
# exec "bin/dev"
37+
# end
3938
end

0 commit comments

Comments
 (0)