diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbd425d..85fed7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 3.4.7 + ruby-version: 3.4 bundler-cache: true - name: Run Rubocop @@ -24,14 +24,16 @@ jobs: test: runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} + name: Ruby ${{ matrix.ruby }} (${{ matrix.appraisal }}) strategy: matrix: - ruby: - - "3.1.7" - - "3.2.9" - - "3.3.10" - - "3.4.7" + ruby: ["3.1", "3.2", "3.3", "3.4"] + appraisal: ["rails_7.1", "rails_7.2", "rails_8.0", "rails_8.1"] + exclude: + - ruby: "3.1" + appraisal: "rails_8.0" + - ruby: "3.1" + appraisal: "rails_8.1" services: postgres: image: postgres:17 @@ -49,21 +51,26 @@ jobs: env: RAILS_ENV: test CI: true + # Use absolute path for BUNDLE_GEMFILE to avoid issues with relative path resolution + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.appraisal }}.gemfile steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Install Ruby and gems - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true - - name: Set up Dummy - run: spec/dummy/bin/setup + - name: Set up Dummy + run: spec/dummy/bin/setup - - name: Run tests - run: bin/rspec + - name: Run tests + run: bin/rspec - - name: Run tests with customization - run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/rspec + - name: Run tests with customization + run: bin/rspec + env: + CHANGE_FIELD_BASE_CLASS: true + CHANGE_VALUE_CLASS: true diff --git a/.gitignore b/.gitignore index dc693c7..59d5ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ .ruby-version Gemfile.lock +gemfiles/*.lock TODO.md diff --git a/.rubocop.yml b/.rubocop.yml index bd2f0cc..d965ebb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,6 +14,7 @@ AllCops: TargetRailsVersion: 8.1 NewCops: enable Exclude: + - "gemfiles/*" - "spec/dummy/db/schema.rb" Layout/LineLength: diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..a17bae5 --- /dev/null +++ b/Appraisals @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# See https://github.com/thoughtbot/appraisal for more information. + +appraise "rails_7.1" do + gem "rails", "~> 7.1.0" +end + +appraise "rails_7.2" do + gem "rails", "~> 7.2.0" +end + +appraise "rails_8.0" do + gem "rails", "~> 8.0.0" +end + +appraise "rails_8.1" do + gem "rails", "~> 8.1.0" +end diff --git a/active_fields.gemspec b/active_fields.gemspec index d2e7955..7d65687 100644 --- a/active_fields.gemspec +++ b/active_fields.gemspec @@ -33,6 +33,7 @@ Gem::Specification.new do |spec| # Dependencies spec.add_dependency "rails", ">= 7.1" + spec.add_development_dependency "appraisal" spec.add_development_dependency "factory_bot" spec.add_development_dependency "pg" spec.add_development_dependency "rake" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 0000000..9094e2a --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 7.1.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 0000000..9695ab3 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 7.2.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_8.0.gemfile b/gemfiles/rails_8.0.gemfile new file mode 100644 index 0000000..39557fd --- /dev/null +++ b/gemfiles/rails_8.0.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 8.0.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_8.1.gemfile b/gemfiles/rails_8.1.gemfile new file mode 100644 index 0000000..195d332 --- /dev/null +++ b/gemfiles/rails_8.1.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 8.1.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/spec/dummy/bin/setup b/spec/dummy/bin/setup index 5e0f9e0..8103740 100755 --- a/spec/dummy/bin/setup +++ b/spec/dummy/bin/setup @@ -16,7 +16,6 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" @@ -26,14 +25,14 @@ FileUtils.chdir APP_ROOT do puts "\n== Preparing database ==" system! "bin/rails db:prepare" + system! "bin/rails db:reset" if ARGV.include?("--reset") puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system! "bin/rails restart" - - # puts "\n== Configuring puma-dev ==" - # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}" - # system "curl -Is https://#{APP_NAME}.test/up | head -n 1" + # unless ARGV.include?("--skip-server") + # puts "\n== Starting development server ==" + # STDOUT.flush # flush the output before exec(2) so that it displays + # exec "bin/dev" + # end end