Skip to content

Commit

Permalink
Refractor CI, Add Rails 7.1 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Oct 17, 2023
1 parent 8e7e7e5 commit b64ac23
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 156 deletions.
68 changes: 33 additions & 35 deletions .github/workflows/test.yml
@@ -1,46 +1,43 @@
name: Tests

on:
push:
branches:
- master
branches: ['master']
pull_request:
branches:
- '*'

jobs:
test_sqlite:
runs-on: ubuntu-20.04
test:
runs-on: ubuntu-latest

env:
RAILS_ENV: test

strategy:
fail-fast: false
matrix:
include:
### TEST ALL RUBY VERSIONS, USE DEFAULT GEMFILE
- ruby: 2.3
- ruby: 2.4
- ruby: 2.5
- ruby: 2.6
- ruby: 2.7
- ruby: "3.0" ### must be quoted otherwise will be treated as "3" which resolves to latest 3.x version
- ruby: 3.1
- ruby: 3.2

### RAILS VERSION TESTING
- ruby: 2.6
gemfile: gemfiles/rails_5.0.sqlite3.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_5.1.sqlite3.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_5.2.sqlite3.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_6.0.sqlite3.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_6.1.sqlite3.gemfile
### TEST RUBY VERSIONS
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.sqlite3.gemfile

env:
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
- ruby: "3.1"
- ruby: "3.2"
### TEST RAILS VERSIONS
- ruby: "2.6"
env:
RAILS_VERSION: "5.2"
- ruby: "2.6"
env:
RAILS_VERSION: "6.0"
- ruby: "2.6"
env:
RAILS_VERSION: "6.1"
- ruby: "3.2"
env:
RAILS_VERSION: "7.0"
- ruby: "3.2"
env:
RAILS_VERSION: "7.1"

steps:
- uses: actions/checkout@v3
Expand All @@ -49,8 +46,9 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
bundler-cache: false ### not compatible with ENV-style Gemfile

- name: Run tests
- name: Run test
run: |
bundle exec rake
bundle install
bundle exec rake test
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -8,7 +8,7 @@ coverage/
doc/
pkg/
spec/reports/
test/dummy_app/**/*.sqlite3.db
test/dummy_app/**/*.sqlite3*
test/dummy_app/**/*.sqlite3
test/dummy_app/**/*.csv
test/dummy_app/**/*.ods
Expand Down
42 changes: 0 additions & 42 deletions Appraisals

This file was deleted.

19 changes: 8 additions & 11 deletions Gemfile
Expand Up @@ -3,16 +3,13 @@ source 'https://rubygems.org'
gemspec

### Must remain in the Gemfile, not gemspec, otherwise Rails integration tests fail
gem 'responders'
gem 'responders'

if (RUBY_VERSION.to_f < 2.5 || false) ### set to true if locally testing old Rails version
#gem 'rails', '~> 5.0.7'
#gem 'rails', '~> 5.1.7'
gem 'rails', "~> 5.2.4"
gem 'sqlite3', '~> 1.3.6'
else
#gem 'rails', '~> 6.0.3'
#gem 'rails', '~> 6.1.1'
gem 'rails'
gem 'sqlite3'
def get_env(name)
(ENV[name] && !ENV[name].empty?) ? ENV[name] : nil
end

gem "rails", get_env("RAILS_VERSION")
gem "sqlite3"

gem "minitest-spec-rails", git: "https://github.com/metaskills/minitest-spec-rails.git"
9 changes: 0 additions & 9 deletions gemfiles/rails_5.0.sqlite3.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_5.1.sqlite3.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_5.2.sqlite3.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_6.0.sqlite3.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_6.1.sqlite3.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_7.0.sqlite3.gemfile

This file was deleted.

13 changes: 3 additions & 10 deletions spreadsheet_architect.gemspec
Expand Up @@ -8,27 +8,20 @@ Gem::Specification.new do |s|
s.author = "Weston Ganger"
s.email = 'weston@westonganger.com'
s.homepage = 'https://github.com/westonganger/spreadsheet_architect'

s.summary = "Spreadsheet Architect is a library that allows you to create XLSX, ODS, or CSV spreadsheets easily from ActiveRecord relations, Plain Ruby classes, or predefined data."
s.description = s.summary
s.description = s.summary
s.license = 'MIT'

s.files = Dir.glob("{lib/**/*}") + %w{ LICENSE README.md Rakefile CHANGELOG.md }
s.require_path = 'lib'

s.required_ruby_version = '>= 2.3.0'

s.add_runtime_dependency 'caxlsx', ['>= 3.3.0', '<4']
s.add_runtime_dependency 'rodf', ['>= 1.0.0', '<2']

s.add_development_dependency 'rake'
s.add_development_dependency 'bundler'
s.add_development_dependency 'minitest'
s.add_development_dependency 'minitest-reporters'
s.add_development_dependency 'minitest-spec-rails'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'rails'
s.add_development_dependency 'pry'

if RUBY_VERSION.to_f >= 2.4
Expand Down
4 changes: 1 addition & 3 deletions test/dummy_app/config/application.rb
Expand Up @@ -48,9 +48,7 @@ class Application < Rails::Application
if ActiveRecord.respond_to?(:gem_version)
gem_version = ActiveRecord.gem_version

if gem_version >= Gem::Version.new("7.0.0")
config.active_record.legacy_connection_handling = false
elsif gem_version.to_s.start_with?("5.2.")
if gem_version.to_s.start_with?("5.2.")
config.active_record.sqlite3.represent_boolean_as_integer = true
end
end
Expand Down

0 comments on commit b64ac23

Please sign in to comment.