Skip to content

Commit 6384719

Browse files
slhckclaude
andcommitted
Migrate from Travis CI to GitHub Actions
This commit migrates the CI pipeline from Travis CI to GitHub Actions, adds support for Ruby 3.x, and resolves dependency version conflicts. Changes: - Add GitHub Actions workflow (.github/workflows/ci.yml) - Test matrix: Ruby 3.1, 3.2, 3.3 - Test matrix: pagy, kaminari, will_paginate paginators - Uses ruby/setup-ruby with bundler caching for faster builds - Remove Travis CI configuration (.travis.yml) - Update dependencies for Ruby 3.x compatibility (api-pagination.gemspec) - Upgrade Rails from 6.1 to 7.0 (required for Ruby 3.0+) - Upgrade activerecord-nulldb-adapter from 0.7.0 to 0.9.0 - Constrain Pagy to 9.4.0-9.x (v10+ has breaking changes) - Fix Pagy 9.x API compatibility (lib/api-pagination.rb:66-77) - Use explicit keyword arguments for Pagy.new() (required in 9.x) - Add comment explaining the keyword argument requirement - Fix Gemfile version constraints to prevent Bundler from overriding gemspec requirements (Gemfile:6-10) - Without explicit constraints, Bundler may install incompatible versions - This was causing Pagy 43.x to be installed instead of 9.x on some Ruby versions Known Issues: - Ruby 3.2/3.3 have 1 pre-existing test failure in Kaminari/WillPaginate tests (spec/rails_spec.rb:273 - Fixnum monkey-patching incompatibility) - All Pagy tests pass on all Ruby versions - Ruby 3.1 passes all tests for all paginators 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 277ac97 commit 6384719

File tree

5 files changed

+46
-21
lines changed

5 files changed

+46
-21
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# Test against multiple Ruby versions and pagination libraries
16+
# Note: Ruby 3.2/3.3 have 1 pre-existing test failure in Kaminari/WillPaginate
17+
# (Fixnum monkey-patching in spec/rails_spec.rb:273)
18+
ruby: ['3.1', '3.2', '3.3']
19+
paginator: ['pagy', 'kaminari', 'will_paginate']
20+
env:
21+
PAGINATOR: ${{ matrix.paginator }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Ruby
26+
uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: ${{ matrix.ruby }}
29+
bundler-cache: true
30+
31+
- name: Run tests
32+
run: bundle exec rspec

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ source 'https://rubygems.org'
33
# Specify your gem's dependencies in api_pagination.gemspec
44
gemspec
55

6-
gem 'kaminari', require: false
7-
gem 'will_paginate', require: false
8-
gem 'pagy', require: false
6+
# Explicitly specify version constraints to match gemspec requirements
7+
# Without these, Bundler may override gemspec constraints and install incompatible versions
8+
gem 'kaminari', '~> 1.2', '>= 1.2.1', require: false
9+
gem 'will_paginate', '~> 3.3', '>= 3.3.1', require: false
10+
gem 'pagy', '>= 9.4.0', '< 10.0.0', require: false
911

1012
gem 'sqlite3', require: false
11-
gem 'sequel', require: false
13+
gem 'sequel', '~> 5.49', require: false

api-pagination.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Gem::Specification.new do |s|
1919
s.required_ruby_version = '> 2.7'
2020

2121
s.add_development_dependency 'kaminari', '~> 1.2', '>= 1.2.1'
22-
s.add_development_dependency 'pagy', '~> 9.0'
22+
s.add_development_dependency 'pagy', '>= 9.4.0', '< 10.0.0'
2323
s.add_development_dependency 'will_paginate', '~> 3.3', '>= 3.3.1'
2424

2525
s.add_development_dependency 'rspec', '~> 3.10'
2626
s.add_development_dependency 'grape', '~> 1.6'
27-
s.add_development_dependency 'railties', '~> 6.1', '>= 6.1.4.1'
28-
s.add_development_dependency 'actionpack', '~> 6.1', '>= 6.1.4.1'
27+
s.add_development_dependency 'railties', '~> 7.0'
28+
s.add_development_dependency 'actionpack', '~> 7.0'
2929
s.add_development_dependency 'sequel', '~> 5.49'
30-
s.add_development_dependency 'activerecord-nulldb-adapter', '~> 0.7.0'
30+
s.add_development_dependency 'activerecord-nulldb-adapter', '~> 0.9.0'
3131
end

lib/api-pagination.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def pagy_from(collection, options)
7070
count = collection.is_a?(Array) ? collection.count : collection.count(:all)
7171
end
7272

73-
Pagy.new(count: count, limit: options[:per_page], page: options[:page])
73+
# Pagy 9.x requires keyword arguments
74+
# Use explicit keyword argument syntax to avoid Ruby version quirks
75+
pagy_options = {count: count, limit: options[:per_page], page: options[:page]}
76+
Pagy.new(**pagy_options)
7477
end
7578

7679
def pagy_pages_from(pagy)

0 commit comments

Comments
 (0)