Skip to content

Commit 1dd6e5c

Browse files
committed
Refactor model to modular concerns and add Rails 8.1 support
1 parent e5ff055 commit 1dd6e5c

33 files changed

Lines changed: 566 additions & 303 deletions

.github/workflows/tests.yml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
name: Gem Tests
22

3-
on:
3+
on:
44
pull_request:
55
push:
66
branches:
77
- master
88

99
jobs:
10-
run:
11-
name: Run Tests for Ruby ${{ matrix.ruby }}
12-
10+
test:
1311
runs-on: ubuntu-latest
12+
name: Ruby ${{ matrix.ruby }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
# Testing against all major supported Ruby versions
17+
ruby: ['4.0', '3.5', '3.4', '3.3', '3.2', '3.1', '3.0', '2.7']
1418

1519
services:
1620
postgres:
17-
image: postgres
21+
image: postgres:16
1822
env:
1923
POSTGRES_PASSWORD: postgres
2024
POSTGRES_DB: pg_ltree_test
@@ -26,20 +30,6 @@ jobs:
2630
--health-timeout 5s
2731
--health-retries 5
2832
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
ruby:
33-
- 'head'
34-
- '3.4'
35-
- '3.3'
36-
- '3.2'
37-
- '3.1'
38-
- '3.0'
39-
- '2.7'
40-
41-
continue-on-error: ${{ matrix.ruby == 'head' }}
42-
4333
steps:
4434
- uses: actions/checkout@v4
4535

@@ -49,11 +39,29 @@ jobs:
4939
ruby-version: ${{ matrix.ruby }}
5040
bundler-cache: true
5141

52-
- name: Setup DB
42+
- name: Setup DB config
5343
run: cp spec/database.yml.sample spec/database.yml
54-
55-
- name: Install dependencies
44+
45+
- name: Install Appraisal dependencies
5646
run: bundle exec appraisal install
5747

58-
- name: Run tests
48+
- name: Run Tests (Appraisal)
5949
run: bundle exec appraisal rake spec
50+
env:
51+
PGHOST: localhost
52+
PGUSER: postgres
53+
PGPASSWORD: postgres
54+
55+
# Dedicated job for linting to fail fast
56+
lint:
57+
runs-on: ubuntu-latest
58+
name: Linting
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Set up Ruby
62+
uses: ruby/setup-ruby@v1
63+
with:
64+
ruby-version: '3.4'
65+
bundler-cache: true
66+
- name: Run Lint
67+
run: bundle exec rake lint

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ doc
88
coverage
99
database.yml
1010
*.lock
11+
12+
# .graphifyignore
13+
vendor/
14+
node_modules/
15+
dist/
16+
*.generated.py
17+
graphify-out/
18+
.agents/

Appraisals

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def add_appraise_for(activerecord_version:, pg_version:)
1717
end
1818
end
1919

20-
SUPPORTED_PG_VERSIONS = ["~> 1.0", "~> 1.1", "~> 1.2", "~> 1.3", "~> 1.4", "~> 1.5"]
20+
SUPPORTED_PG_VERSIONS = ["~> 1.0", "~> 1.1", "~> 1.2", "~> 1.3", "~> 1.4", "~> 1.5", "~> 1.6"]
2121

2222
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("3.0")
2323
SUPPORTED_PG_VERSIONS.map do |pg_version|
@@ -46,5 +46,6 @@ end
4646
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2")
4747
SUPPORTED_PG_VERSIONS.map do |pg_version|
4848
add_appraise_for(activerecord_version: "~> 8.0", pg_version: pg_version)
49+
add_appraise_for(activerecord_version: "~> 8.1", pg_version: pg_version)
4950
end
5051
end

Rakefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ require "standard/rake"
33
require "rspec/core/rake_task"
44
require "appraisal"
55

6+
desc "Run all tests"
67
RSpec::Core::RakeTask.new(:spec)
78

8-
task default: :spec
9+
desc "Run linting"
10+
task lint: :standard
11+
12+
desc "Run all tests across all appraisals"
13+
task :test_all do
14+
sh "bundle exec appraisal rake spec"
15+
end
16+
17+
task default: [:lint, :spec]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 6.0", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 6.1", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 7.0", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 7.1", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 7.2", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 8.0", require: "active_record"
6+
gem "pg", "~> 1.6"
7+
8+
gemspec path: "../"

0 commit comments

Comments
 (0)