Skip to content

Commit

Permalink
Setup Appraisals for Rails version testing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdunae committed Jun 3, 2021
1 parent 45ab803 commit 27cdab3
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 7 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,3 +9,4 @@ test/dummy/.sass-cache
*.gem
.DS_Store
Gemfile.lock
*.gemfile.lock
7 changes: 7 additions & 0 deletions Appraisals
@@ -0,0 +1,7 @@
appraise "rails-5" do
gem "rails", "~> 5", "< 6"
end

appraise "rails-6" do
gem "rails", "~> 6", "< 7"
end
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -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
```
12 changes: 12 additions & 0 deletions 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: "../"
12 changes: 12 additions & 0 deletions 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: "../"
5 changes: 3 additions & 2 deletions spatial_features.gemspec
Expand Up @@ -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

0 comments on commit 27cdab3

Please sign in to comment.