Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/ci-simple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sqlquery_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
CI: true
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Run tests
run: bundle exec rspec

- name: Check coverage
run: |
echo "Coverage report generated at coverage/index.html"
if [ -f coverage/.last_run.json ]; then
echo "Coverage summary:"
cat coverage/.last_run.json
fi

- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage/
retention-days: 7

lint:
name: RuboCop
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop --format progress
122 changes: 122 additions & 0 deletions .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Test Matrix

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
test:
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.2']
rails: ['4.2', '5.2', '6.0', '6.1', '7.0', '7.1', '8.0']
exclude:
# Ruby 2.7 officially supports Rails 4.2-7.0
- ruby: '2.7'
rails: '7.1'
- ruby: '2.7'
rails: '8.0'
# Ruby 3.2 requires Rails 7.0+
- ruby: '3.2'
rails: '4.2'
- ruby: '3.2'
rails: '5.2'
- ruby: '3.2'
rails: '6.0'
- ruby: '3.2'
rails: '6.1'

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sqlquery_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
CI: true
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
RAILS_VERSION: ${{ matrix.rails }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: false

- name: Install dependencies with specific Rails version
run: |
if [ "${{ matrix.rails }}" = "4.2" ]; then
bundle install --gemfile=gemfiles/4.2.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "5.2" ]; then
bundle install --gemfile=gemfiles/5.2.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "6.0" ]; then
bundle install --gemfile=gemfiles/6.0.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "6.1" ]; then
bundle install --gemfile=gemfiles/6.1.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "7.0" ]; then
bundle install --gemfile=gemfiles/7.0.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "7.1" ]; then
bundle install --gemfile=gemfiles/7.1.gemfile --jobs=4 --retry=3
elif [ "${{ matrix.rails }}" = "8.0" ]; then
bundle install --gemfile=gemfiles/8.0.gemfile --jobs=4 --retry=3
else
bundle install --jobs=4 --retry=3
fi

- name: Run tests
run: |
if [ "${{ matrix.rails }}" = "4.2" ]; then
bundle exec --gemfile=gemfiles/4.2.gemfile rspec
elif [ "${{ matrix.rails }}" = "5.2" ]; then
bundle exec --gemfile=gemfiles/5.2.gemfile rspec
elif [ "${{ matrix.rails }}" = "6.0" ]; then
bundle exec --gemfile=gemfiles/6.0.gemfile rspec
elif [ "${{ matrix.rails }}" = "6.1" ]; then
bundle exec --gemfile=gemfiles/6.1.gemfile rspec
elif [ "${{ matrix.rails }}" = "7.0" ]; then
bundle exec --gemfile=gemfiles/7.0.gemfile rspec
elif [ "${{ matrix.rails }}" = "7.1" ]; then
bundle exec --gemfile=gemfiles/7.1.gemfile rspec
elif [ "${{ matrix.rails }}" = "8.0" ]; then
bundle exec --gemfile=gemfiles/8.0.gemfile rspec
else
bundle exec rspec
fi

lint:
name: RuboCop
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop --format progress
33 changes: 33 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
AllCops:
NewCops: enable
TargetRubyVersion: 3.2
Exclude:
- 'vendor/**/*'
- 'gemfiles/**/*'

# Style - Documentation not required for small gems
Style/Documentation:
Enabled: false

# Style - Optional boolean parameters are acceptable in this API
Style/OptionalBooleanParameter:
Enabled: false

# Metrics - Allow longer blocks in specs
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- '**/*.gemspec'

# Lint - Allow constant definition in RSpec blocks
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/**/*.rb'

# Gemspec - Ruby version is intentionally broad for compatibility
Gemspec/RequiredRubyVersion:
Enabled: false

# Gemspec - Development dependencies in gemspec is acceptable for gems
Gemspec/DevelopmentDependencies:
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.3
3.2.2
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

39 changes: 29 additions & 10 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
# frozen_string_literal: true

appraise '3.2' do
gem 'activerecord', '~> 3.2.21'
appraise '4.2' do
gem 'activerecord', '~> 4.2.0'
gem 'with_model', '~> 2.0.0'
gem 'pg', '~> 0.21'
end

appraise '4.0' do
gem 'activerecord', '~> 4.0.0'
appraise '5.2' do
gem 'activerecord', '~> 5.2.0'
gem 'with_model', '~> 2.1.6'
gem 'pg', '~> 1.1'
end

appraise '4.1' do
gem 'activerecord', '~> 4.1.0'
appraise '6.0' do
gem 'activerecord', '~> 6.0.0'
gem 'with_model', '~> 2.1.6'
gem 'pg', '~> 1.1'
end

appraise '4.2' do
gem 'activerecord', '~> 4.2.0'
appraise '6.1' do
gem 'activerecord', '~> 6.1.0'
gem 'with_model', '~> 2.1.6'
gem 'pg', '~> 1.1'
end

appraise '7.0' do
gem 'activerecord', '~> 7.0.0'
gem 'with_model', '~> 2.1.7'
end

appraise '7.1' do
gem 'activerecord', '~> 7.1.0'
gem 'with_model', '~> 2.1.7'
end

appraise '5.0' do
gem 'activerecord', '~> 5.0.0'
appraise '8.0' do
gem 'activerecord', '~> 8.0.0'
gem 'with_model', '~> 2.1.7'
end
9 changes: 0 additions & 9 deletions gemfiles/3.2.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/4.0.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/4.1.gemfile

This file was deleted.

10 changes: 5 additions & 5 deletions gemfiles/4.2.gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'activerecord', '~> 4.2.0'
gem "activerecord", "~> 4.2.0"
gem "with_model", "~> 2.0.0"
gem "pg", "~> 0.21"

gemspec path: '../'
gemspec path: "../"
9 changes: 0 additions & 9 deletions gemfiles/5.0.gemfile

This file was deleted.

9 changes: 9 additions & 0 deletions gemfiles/5.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 5.2.0"
gem "with_model", "~> 2.1.6"
gem "pg", "~> 1.1"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 6.0.0"
gem "with_model", "~> 2.1.6"
gem "pg", "~> 1.1"

gemspec path: "../"
Loading