Skip to content

Commit

Permalink
Update versions in CI config, add Ruby 3.1 and Rails 7.0
Browse files Browse the repository at this point in the history
Addresses lints from more recent versions of Rubocop.
Also adds dependabot for GitHub Actions.
  • Loading branch information
petergoldstein authored and stas committed Jun 29, 2022
1 parent 5235339 commit 40b53a0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

services:
postgres:
image: postgres:11.6
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -19,20 +19,30 @@ jobs:

strategy:
matrix:
ruby: [2.4, 2.7, 3.0]
rails: [4, 5, 6]
ruby: [2.4, 2.7, '3.0', 3.1]
rails: [4, 5, 6.0, 6.1, 7.0]
exclude:
- ruby: 2.4
rails: 6
rails: 6.0
- ruby: 2.4
rails: 6.1
- ruby: 2.4
rails: 7.0
- ruby: 2.7
rails: 4
- ruby: 3
- ruby: '3.0'
rails: 4
- ruby: '3.0'
rails: 5
- ruby: 3.1
rails: 4
- ruby: 3
- ruby: 3.1
rails: 5
- ruby: 3.1
rails: 6.0

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Style/StringLiterals:
Style/FrozenStringLiteralComment:
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Max: 80

Metrics/BlockLength:
Expand Down
3 changes: 2 additions & 1 deletion active_record-pgcrypto.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.files += %w[LICENSE.txt README.md]
spec.require_paths = ['lib']

spec.add_dependency 'activerecord', (ENV['RAILS_VERSION'] || '>= 3.2')
spec.add_dependency 'activerecord', ENV.fetch('RAILS_VERSION', '>= 3.2')

pg_version = '< 1' if ENV['RAILS_VERSION'].to_s.split.last.to_i == 4

Expand All @@ -30,4 +30,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'yardstick'
spec.metadata['rubygems_mfa_required'] = 'true'
end
6 changes: 3 additions & 3 deletions lib/active_record/pgcrypto/symmetric_coder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module PGCrypto
# PGCrypto symmetric encryption/decryption coder for attribute serialization
module SymmetricCoder
mattr_accessor :pgcrypto_key do
ENV['PGCRYPTO_SYM_KEY']
ENV.fetch('PGCRYPTO_SYM_KEY', nil)
end
mattr_accessor :pgcrypto_options do
ENV['PGCRYPTO_SYM_OPTIONS'] || 'cipher-algo=aes256, unicode-mode=1'
ENV.fetch('PGCRYPTO_SYM_OPTIONS', 'cipher-algo=aes256, unicode-mode=1')
end
mattr_accessor :pgcrypto_encoding do
Encoding.find(ENV['PGCRYPTO_ENCODING'] || 'utf-8')
Encoding.find(ENV.fetch('PGCRYPTO_ENCODING', 'utf-8'))
end

# Decrypts the requested value
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require 'logger'

ActiveRecord::Base.logger = Logger.new($stdout)
ActiveRecord::Base.logger.level = ENV['LOG_LEVEL'] || Logger::WARN
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
ActiveRecord::Base.logger.level = ENV.fetch('LOG_LEVEL') { Logger::WARN }
ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL', nil))

ActiveRecord::Schema.define do
enable_extension 'pgcrypto'
Expand Down

0 comments on commit 40b53a0

Please sign in to comment.