diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed96ad8..536b3cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.6', '2.7'] - + ruby-version: ['2.5'] + appraisal-version: ['rails-5', 'rails-6'] + fail-fast: false services: postgres: image: postgis/postgis @@ -35,15 +36,19 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically + bundler: 2 + bundler-cache: false # runs 'bundle install' and caches installed gems automatically - name: Install GEOS run: sudo apt-get install libgeos-dev libgeos-3.8.0 libproj-dev -y + - name: Setup appraisal + run: | + bundle exec appraisal install + - name: Run tests env: RAILS_ENV: test POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - run: bundle exec rake spec - continue-on-error: true + run: bundle exec appraisal ${{ matrix.appraisal-version }} rake spec diff --git a/.gitignore b/.gitignore index 64afe86..ec2b5c4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ test/dummy/.sass-cache *.gem .DS_Store Gemfile.lock +*.gemfile.lock diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..c5be844 --- /dev/null +++ b/Appraisals @@ -0,0 +1,7 @@ +appraise "rails-5" do + gem "rails", "~> 5", "< 6" +end + +appraise "rails-6" do + gem "rails", "~> 6", "< 7" +end diff --git a/README.md b/README.md index dd86d33..a1485e4 100644 --- a/README.md +++ b/README.md @@ -150,3 +150,19 @@ Feature.reset_column_information AbstractFeature.update_all(:type => 'Feature') Feature.refresh_aggregates ``` + +## Testing + +Define Rails versions you'd like to test in the `Appraisals` file and then run `bundle exec appraisal install` + +Run tests against all your Rails versions: + +```bash +bundle exec appraisal rake spec +``` + +Or just run specific versions: + +```bash +bundle exec appraisal rails-5 rake +``` diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile new file mode 100644 index 0000000..6da9af1 --- /dev/null +++ b/gemfiles/rails_5.gemfile @@ -0,0 +1,12 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 5", "< 6" + +group :test do + gem "pry" + gem "pry-byebug" +end + +gemspec path: "../" diff --git a/gemfiles/rails_6.gemfile b/gemfiles/rails_6.gemfile new file mode 100644 index 0000000..c74304c --- /dev/null +++ b/gemfiles/rails_6.gemfile @@ -0,0 +1,12 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 6", "< 7" + +group :test do + gem "pry" + gem "pry-byebug" +end + +gemspec path: "../" diff --git a/spatial_features.gemspec b/spatial_features.gemspec index 6d15ef6..de13084 100644 --- a/spatial_features.gemspec +++ b/spatial_features.gemspec @@ -17,13 +17,14 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_runtime_dependency "rails", '>= 4.2', '< 6.0' + s.add_runtime_dependency "rails", '>= 4.2', '< 7.0' s.add_runtime_dependency "delayed_job_active_record", '~> 4.1' s.add_runtime_dependency "rgeo-shapefile", '~> 3.0' s.add_runtime_dependency "rubyzip", '>= 1.0.0' s.add_runtime_dependency "nokogiri", '~> 1.6' s.add_runtime_dependency "chroma", "~> 0.1.0" - s.add_development_dependency "pg", '~> 0' + s.add_development_dependency "pg", '~> 1' + s.add_development_dependency "appraisal" s.add_development_dependency "rspec", '~> 3.5' end