Skip to content

Commit 91fa319

Browse files
committed
Update CI config, fix specs and code style
1 parent 7cc7676 commit 91fa319

File tree

9 files changed

+31
-128
lines changed

9 files changed

+31
-128
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
name: RuboCop
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919
- uses: ruby/setup-ruby@v1
2020
with:
21-
ruby-version: "3.1"
21+
ruby-version: "3.3"
2222
bundler-cache: true
2323
- name: Lint Ruby code with RuboCop
2424
run: |

.github/workflows/test.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ jobs:
1616
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
1717
name: 'Ruby ${{ matrix.ruby }} × AR ${{ matrix.activerecord }} × Yabeda ${{ matrix.yabeda }}'
1818
runs-on: ubuntu-latest
19+
continue-on-error: ${{ matrix.optional || false }}
1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
include:
23-
- ruby: '2.7'
24-
activerecord: '6.0'
25-
yabeda: '0.11'
2624
- ruby: '2.7'
2725
activerecord: '6.1'
2826
yabeda: '0.11'
@@ -31,30 +29,28 @@ jobs:
3129
yabeda: '0.11'
3230
- ruby: '3.1'
3331
activerecord: '7.1'
34-
yabeda: '0.11'
32+
yabeda: '0.12'
3533
- ruby: '3.2'
34+
activerecord: '7.2'
35+
yabeda: '0.13'
36+
- ruby: '3.3'
37+
activerecord: '8.0'
38+
yabeda: '0.14'
39+
- ruby: '3.4'
40+
activerecord: '8.0'
41+
yabeda: '0.14'
42+
- ruby: 'head'
3643
activerecord: 'HEAD'
3744
yabeda: 'HEAD'
38-
container:
39-
image: ruby:${{ matrix.ruby }}
40-
env:
41-
CI: true
42-
YABEDA_VERSION: ${{ matrix.yabeda }}
43-
ACTIVERECORD_VERSION: ${{ matrix.activerecord }}
45+
optional: true
46+
env:
47+
YABEDA_VERSION: ${{ matrix.yabeda }}
48+
ACTIVERECORD_VERSION: ${{ matrix.activerecord }}
4449
steps:
45-
- uses: actions/checkout@v2
46-
- uses: actions/cache@v2
50+
- uses: actions/checkout@v4
51+
- uses: ruby/setup-ruby@v1
4752
with:
48-
path: vendor/bundle
49-
key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
50-
restore-keys: |
51-
bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
52-
bundle-${{ matrix.ruby }}-
53-
- name: Upgrade Bundler to 2.x (mostly for Rubies older than 2.7)
54-
run: gem install bundler -v '~> 2.0' -v '!= 2.2.10'
55-
- name: Bundle install
56-
run: |
57-
bundle config path vendor/bundle
58-
bundle update
53+
ruby-version: ${{ matrix.ruby }}
54+
bundler-cache: true
5955
- name: Run RSpec
6056
run: bundle exec rspec

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ else
2727
gem "activerecord", activerecord_version
2828
end
2929

30-
gem "sqlite3"
30+
if activerecord_version.match(/\d+\.\d+/)&.then(&Gem::Version.method(:new))&.< Gem::Version.new("8.0")
31+
gem "sqlite3", "~> 1.4"
32+
else
33+
gem "sqlite3", "~> 2.0"
34+
end
3135

3236
gem "rake", "~> 13.0"
3337

Gemfile.lock

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

lib/yabeda/active_record.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class Error < StandardError; end
1515
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, # standard (from Prometheus)
1616
30, 60, 120, 300, 1800, 3600, 21_600, # Well, sometime queries can execute way too long
1717
].freeze
18-
19-
18+
2019
# rubocop: disable Layout/LineLength
2120
Yabeda.configure do
2221
config = ::Yabeda::ActiveRecord::Config.new

lib/yabeda/active_record/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'anyway'
3+
require "anyway"
44

55
module Yabeda
66
module ActiveRecord

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require "bundler/setup"
4+
require "logger"
45
require "yabeda/activerecord"
56
require "yabeda/rspec"
67

spec/support/database.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ActiveRecord::Base.configurations
1818
end
1919

20-
database_config.each do |_name, config|
20+
database_config.each_value do |config|
2121
next unless config["adapter"] == "sqlite3"
2222
next if config["database"] == ":memory:" || !File.exist?(config["database"])
2323

yabeda-activerecord.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
3232
spec.require_paths = ["lib"]
3333

3434
spec.add_dependency "activerecord", ">= 6.0"
35-
spec.add_dependency "yabeda", "~> 0.6"
3635
spec.add_dependency "anyway_config", ">= 1.3", "< 3.0"
36+
spec.add_dependency "yabeda", "~> 0.6"
3737
end

0 commit comments

Comments
 (0)