Skip to content

Commit 64da400

Browse files
committed
Prepare Active Postgres for Ruby 4
1 parent 6b19991 commit 64da400

33 files changed

Lines changed: 475 additions & 355 deletions

‎.github/dependabot.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: "06:20"
9+
timezone: "Etc/UTC"
10+
open-pull-requests-limit: 5
11+
labels: [dependencies]
12+
commit-message:
13+
prefix: deps
14+
include: scope
15+
groups:
16+
bundler-security:
17+
applies-to: security-updates
18+
patterns: ["*"]
19+
bundler-minor-patch:
20+
applies-to: version-updates
21+
patterns: ["*"]
22+
update-types: [minor, patch]
23+
24+
- package-ecosystem: github-actions
25+
directory: "/"
26+
schedule:
27+
interval: weekly
28+
day: monday
29+
time: "06:40"
30+
timezone: "Etc/UTC"
31+
labels: [dependencies]
32+
commit-message:
33+
prefix: deps
34+
include: scope
35+
groups:
36+
actions-minor-patch:
37+
patterns: ["*"]
38+
update-types: [minor, patch]

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,37 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main ]
8+
workflow_dispatch:
89

910
permissions:
1011
contents: read
1112

1213
jobs:
13-
test:
14+
verify:
1415
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
ruby-version: ['3.3', '3.4']
1816

1917
steps:
20-
- uses: actions/checkout@v4
21-
22-
- name: Set up Ruby ${{ matrix.ruby-version }}
23-
uses: ruby/setup-ruby@v1
24-
with:
25-
ruby-version: ${{ matrix.ruby-version }}
26-
bundler-cache: true
27-
28-
- name: Install dependencies
29-
run: bundle install
30-
31-
- name: Run tests
32-
run: bundle exec rake test
33-
34-
- name: Upload coverage reports
35-
uses: codecov/codecov-action@v4
36-
if: matrix.ruby-version == '3.4'
18+
- uses: actions/checkout@v6
3719
with:
38-
files: ./coverage/.resultset.json
39-
fail_ci_if_error: false
40-
41-
lint:
42-
runs-on: ubuntu-latest
43-
44-
steps:
45-
- uses: actions/checkout@v4
20+
persist-credentials: false
4621

4722
- name: Set up Ruby
4823
uses: ruby/setup-ruby@v1
4924
with:
50-
ruby-version: '3.4'
25+
ruby-version: '4.0.6'
5126
bundler-cache: true
5227

53-
- name: Install dependencies
54-
run: bundle install
28+
- name: Run tests
29+
run: bundle exec rake test
5530

5631
- name: Run RuboCop
57-
run: bundle exec rubocop --format progress --format json --out rubocop-results.json
58-
continue-on-error: true
59-
60-
- name: Upload RuboCop results
61-
uses: actions/upload-artifact@v4
62-
if: always()
63-
with:
64-
name: rubocop-results
65-
path: rubocop-results.json
32+
run: bundle exec rubocop
6633

67-
build:
68-
runs-on: ubuntu-latest
69-
needs: [test, lint]
70-
71-
steps:
72-
- uses: actions/checkout@v4
73-
74-
- name: Set up Ruby
75-
uses: ruby/setup-ruby@v1
76-
with:
77-
ruby-version: '3.4'
78-
bundler-cache: true
34+
- name: Audit dependencies
35+
run: bundle exec bundle-audit check --update
7936

8037
- name: Build gem
81-
run: bundle exec rake build
82-
83-
- name: Upload gem artifact
84-
uses: actions/upload-artifact@v4
85-
with:
86-
name: gem-package
87-
path: pkg/*.gem
38+
run: gem build active_postgres.gemspec

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
*.gem
2+
.bundle/
3+
vendor/
24
coverage/
5+
pkg/
6+
tmp/
37
.byebug_history
8+
.DS_Store

‎.rubocop.yml‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AllCops:
22
NewCops: enable
3-
TargetRubyVersion: 3.3
3+
TargetRubyVersion: 4.0
44
SuggestExtensions: false
55
Exclude:
66
- 'vendor/**/*'
@@ -14,18 +14,26 @@ Layout/LineLength:
1414
Metrics/MethodLength:
1515
Max: 35
1616
Exclude:
17+
- 'lib/active_postgres/configuration.rb'
1718
- 'lib/active_postgres/components/repmgr.rb'
1819
- 'lib/active_postgres/connection_pooler.rb'
1920
- 'lib/active_postgres/generators/active_postgres/install_generator.rb'
2021
- 'lib/active_postgres/performance_tuner.rb'
2122
- 'lib/active_postgres/ssh_executor.rb'
23+
- 'lib/active_postgres/health_checker.rb'
24+
- 'lib/active_postgres/overview.rb'
25+
- 'test/components/pgbouncer_test.rb'
2226

2327
Metrics/ClassLength:
2428
Max: 250
2529
Exclude:
2630
- 'lib/active_postgres/components/repmgr.rb'
2731
- 'lib/active_postgres/connection_pooler.rb'
2832
- 'lib/active_postgres/ssh_executor.rb'
33+
- 'lib/active_postgres/components/pgbouncer.rb'
34+
- 'lib/active_postgres/health_checker.rb'
35+
- 'lib/active_postgres/overview.rb'
36+
- 'test/components/pgbouncer_test.rb'
2937

3038
Metrics/AbcSize:
3139
Max: 40
@@ -36,26 +44,42 @@ Metrics/AbcSize:
3644
- 'lib/active_postgres/performance_tuner.rb'
3745
- 'lib/active_postgres/ssh_executor.rb'
3846
- 'lib/active_postgres/validator.rb'
47+
- 'lib/active_postgres/components/pgbouncer.rb'
48+
- 'lib/active_postgres/configuration.rb'
49+
- 'lib/active_postgres/health_checker.rb'
50+
- 'lib/active_postgres/overview.rb'
3951

4052
Metrics/CyclomaticComplexity:
4153
Max: 12
4254
Exclude:
4355
- 'lib/active_postgres/components/repmgr.rb'
4456
- 'lib/active_postgres/connection_pooler.rb'
4557
- 'lib/active_postgres/generators/active_postgres/install_generator.rb'
58+
- 'lib/active_postgres/configuration.rb'
59+
- 'lib/active_postgres/error_handler.rb'
60+
- 'lib/active_postgres/health_checker.rb'
61+
- 'lib/active_postgres/overview.rb'
62+
- 'test/test_helper.rb'
4663

4764
Metrics/PerceivedComplexity:
4865
Max: 12
4966
Exclude:
5067
- 'lib/active_postgres/components/repmgr.rb'
5168
- 'lib/active_postgres/connection_pooler.rb'
5269
- 'lib/active_postgres/generators/active_postgres/install_generator.rb'
70+
- 'lib/active_postgres/configuration.rb'
71+
- 'lib/active_postgres/error_handler.rb'
72+
- 'lib/active_postgres/health_checker.rb'
73+
- 'lib/active_postgres/overview.rb'
74+
- 'test/test_helper.rb'
5375

5476
Metrics/BlockLength:
5577
Enabled: false
5678

5779
Metrics/ParameterLists:
5880
Max: 6
81+
Exclude:
82+
- 'lib/active_postgres/ssh_executor.rb'
5983

6084
Style/Documentation:
6185
Enabled: false
@@ -82,5 +106,14 @@ Lint/FormatParameterMismatch:
82106
Exclude:
83107
- 'lib/active_postgres/performance_tuner.rb'
84108

85-
Gemspec/DevelopmentDependencies:
86-
Enabled: false
109+
Naming/VariableNumber:
110+
Exclude:
111+
- 'test/components/pgbouncer_templates_test.rb'
112+
113+
Style/TrivialAccessors:
114+
Exclude:
115+
- 'test/components/pgbouncer_test.rb'
116+
117+
Style/CombinableLoops:
118+
Exclude:
119+
- 'lib/active_postgres/components/repmgr.rb'

‎.ruby-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0.6

‎CHANGELOG.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
All notable changes to Active Postgres will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project follows [Semantic Versioning](https://semver.org/).
7+
8+
## Unreleased
9+
10+
### Changed
11+
12+
- Require Ruby 4.0 or newer and Rails 8.1 or newer for Rails integration.
13+
- Align runtime and development dependencies with the maintained toolchain.
14+
- Add blocking test, lint, dependency-audit, and package-build CI checks.
15+
- Add automated Bundler and GitHub Actions dependency updates.
16+
- Document network, credential, failover, and recovery responsibilities.
17+
18+
## 0.9.5
19+
20+
- Current published release. See the repository history for changes included in
21+
earlier releases.

‎CONTRIBUTING.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
Bug reports and focused pull requests are welcome. For a security issue, follow
4+
[SECURITY.md](SECURITY.md) instead of opening a public issue.
5+
6+
Set up Ruby 4.0.6, install the bundle, and run the local verification commands:
7+
8+
```sh
9+
bundle install
10+
bundle exec rake test
11+
bundle exec rubocop
12+
bundle exec bundle-audit check --update
13+
gem build active_postgres.gemspec
14+
```
15+
16+
Keep deployment changes narrow and include tests for generated PostgreSQL,
17+
PgBouncer, repmgr, backup, and monitoring configuration. Changes affecting
18+
failover or recovery should document how they were exercised in a disposable
19+
environment.

‎Gemfile‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
source 'https://rubygems.org'
22

3+
ruby '>= 4.0.0'
4+
35
gemspec
46

5-
gem 'minitest', '~> 5.0'
6-
gem 'rake', '~> 13.0'
7-
gem 'rubocop', '~> 1.50'
7+
group :development, :test do
8+
gem 'bundler-audit', '~> 0.9', require: false
9+
gem 'minitest', '~> 6.0'
10+
gem 'minitest-mock', '~> 5.27'
11+
gem 'rake', '~> 13.4'
12+
gem 'rubocop', '~> 1.89', require: false
13+
gem 'simplecov', '~> 1.1', require: false
14+
end

0 commit comments

Comments
 (0)