Skip to content

Commit e4111ac

Browse files
committed
Backdate
1 parent 75e0211 commit e4111ac

40 files changed

+524
-234
lines changed

.codeclimate.yml

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
---
2-
engines:
3-
duplication:
4-
enabled: true
5-
config:
6-
languages:
7-
- ruby
8-
- javascript
9-
- python
10-
- php
11-
fixme:
12-
enabled: true
2+
plugins:
133
rubocop:
144
enabled: true
15-
ratings:
16-
paths:
17-
- "**.inc"
18-
- "**.js"
19-
- "**.jsx"
20-
- "**.module"
21-
- "**.php"
22-
- "**.py"
23-
- "**.rb"
24-
exclude_paths:
25-
- spec/
26-
- lib/generators/rails/templates/
5+
channel: rubocop-1-31-0
6+
exclude_patterns:
7+
- spec/
8+
- lib/generators/rails/templates/

.github/workflows/ci.yml

+72-41
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,49 @@
22
name: CI
33

44
on:
5-
- push
6-
- pull_request
5+
push:
6+
branches:
7+
- '**'
8+
pull_request:
9+
branches:
10+
- '**'
11+
schedule:
12+
- cron: '0 4 1 * *'
13+
# Run workflow manually
14+
workflow_dispatch:
715

816
jobs:
17+
rubocop:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Ruby
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: '3.1'
28+
29+
- name: Bundler
30+
run: bundle install
31+
32+
- name: Rubocop
33+
run: bin/rubocop
34+
935
rspec:
10-
runs-on: ubuntu-20.04
36+
runs-on: ubuntu-latest
1137

12-
env:
38+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
39+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile
1340
ORACLE_COOKIE: sqldev
1441
ORACLE_FILE: oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
1542
ORACLE_HOME: /u01/app/oracle/product/11.2.0/xe
1643
ORACLE_SID: XE
1744

1845
services:
1946
postgres:
20-
image: 'postgres:13'
47+
image: 'postgres:16'
2148
ports: ['5432:5432']
2249
env:
2350
POSTGRES_PASSWORD: postgres
@@ -46,75 +73,79 @@ jobs:
4673
fail-fast: false
4774
matrix:
4875
ruby:
49-
- '3.0'
50-
- '2.7'
51-
- '2.6'
52-
- '2.5'
76+
- '3.4'
77+
- '3.3'
78+
- '3.2'
79+
- '3.1'
80+
- 'head'
5381
rails:
54-
- rails_5.2.4
55-
- rails_6.0.3
56-
- rails_6.1.0
82+
- rails_8.0
83+
- rails_7.2
84+
- rails_7.1
5785
adapter:
5886
- sqlite3
5987
- postgresql
6088
- mysql2
6189
- oracle_enhanced
90+
- postgis
91+
# Disabled for now:
92+
# Rails 7.0: trilogy_auth_recv: caching_sha2_password requires either TCP with TLS or a unix socket: TRILOGY_UNSUPPORTED
93+
# Rails 7.1: unknown keyword: :uses_transaction
94+
# Rails 7.2: NotImplementedError
95+
# - trilogy
6296
exclude:
63-
- ruby: '3.0'
64-
rails: rails_5.2.4
97+
# Rails 8.0 needs Ruby > 3.2
98+
- rails: 'rails_8.0'
99+
ruby: '3.1'
100+
101+
# Disabled for now because of build error:
102+
# /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in
103+
# `parse_stream': undefined method `parse' for #<Psych::Parser:0x000055b6cc7b6898
104+
# @handler=#<Psych::Handlers::DocumentStream:0x000055b6cc7b69b0 @stack=[],
105+
# @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil,
106+
# @end_column=nil, @block=#<Proc:0x000055b6cc7b68e8
107+
# /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:391>>,
108+
# @external_encoding=0> (NoMethodError)
109+
# from
110+
# /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in
111+
# `create_apiwrap'
112+
- rails: 'rails_7.2'
113+
adapter: 'oracle_enhanced'
65114

66115
steps:
67116
- name: Checkout
68-
uses: actions/checkout@v2
69-
70-
- name: Setup Ruby
71-
uses: ruby/setup-ruby@v1
72-
with:
73-
ruby-version: ${{ matrix.ruby }}
117+
uses: actions/checkout@v4
74118

75119
- name: Set DB Adapter
76120
env:
77-
RAILS_VERSION: ${{ matrix.rails }}
78121
DB_ADAPTER: ${{ matrix.adapter }}
79122
CUSTOM_ORACLE_FILE: ${{ secrets.CUSTOM_ORACLE_FILE }}
80123

81124
# See: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql
82125
run: |
83-
if [ "${DB_ADAPTER}" = "mysql2" ]; then
126+
if [[ "${DB_ADAPTER}" == "mysql2" ]] || [[ "${DB_ADAPTER}" == "trilogy" ]]; then
84127
sudo systemctl start mysql.service
85128
mysql -u root -proot -e 'create database ajax_datatables_rails;'
86129
fi
87130
88-
if [ "${DB_ADAPTER}" = "oracle_enhanced" ]; then
131+
if [[ "${DB_ADAPTER}" == "oracle_enhanced" ]]; then
89132
./spec/install_oracle.sh
90133
# Fix error : libnnz11.so: cannot open shared object file: No such file or directory
91134
sudo ln -s ${ORACLE_HOME}/lib/libnnz11.so /usr/lib/libnnz11.so
92135
fi
93136
94-
- name: Setup Ruby cache
95-
uses: actions/cache@v2
137+
- name: Setup Ruby
138+
uses: ruby/setup-ruby@v1
96139
with:
97-
path: vendor/bundle
98-
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.adapter }}-${{ hashFiles('**/Gemfile.lock') }}
99-
restore-keys: |
100-
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.adapter }}-
101-
102-
- name: Bundle
140+
ruby-version: ${{ matrix.ruby }}
141+
bundler-cache: true
103142
env:
104-
RAILS_VERSION: ${{ matrix.rails }}
105143
DB_ADAPTER: ${{ matrix.adapter }}
106-
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
107-
run: |
108-
gem install bundler
109-
bundle config path vendor/bundle
110-
bundle install --jobs 4 --retry 3
111144

112145
- name: RSpec & publish code coverage
113-
uses: paambaati/codeclimate-action@v2.7.5
146+
uses: paambaati/codeclimate-action@v9.0.0
114147
env:
115-
RAILS_VERSION: ${{ matrix.rails }}
116148
DB_ADAPTER: ${{ matrix.adapter }}
117-
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
118149
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
119150
with:
120-
coverageCommand: bin/rake
151+
coverageCommand: bin/rspec

.gitignore

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
/coverage
1111
/tmp
1212

13-
# Ignore sqlite db file
14-
/ajax_datatables_rails
15-
1613
# RVM files
1714
/.ruby-version
1815

1916
# Gem files
2017
/*.gem
18+
19+
# Ignore dummy app files
20+
spec/dummy/db/*.sqlite3
21+
spec/dummy/db/*.sqlite3-journal
22+
spec/dummy/log/*.log
23+
spec/dummy/tmp/
24+
25+
# Ignore MacOS files
26+
.DS_Store

.rspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--color
1+
--warnings

.rubocop.yml

+55-28
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
1+
---
2+
require:
3+
- rubocop-factory_bot
4+
- rubocop-performance
5+
- rubocop-rake
6+
- rubocop-rspec
7+
18
AllCops:
29
NewCops: enable
3-
SuggestExtensions: false
4-
TargetRubyVersion: 2.5
10+
TargetRubyVersion: 3.1
511
Exclude:
612
- bin/*
7-
- lib/generators/**/*.rb
813
- gemfiles/*
9-
- spec/**/*
14+
- spec/dummy/**/*
15+
16+
#########
17+
# STYLE #
18+
#########
1019

1120
Style/Documentation:
1221
Enabled: false
1322

14-
Layout/HashAlignment:
15-
Enabled: false
23+
Style/TrailingCommaInArrayLiteral:
24+
EnforcedStyleForMultiline: comma
25+
26+
Style/TrailingCommaInHashLiteral:
27+
EnforcedStyleForMultiline: comma
28+
29+
Style/BlockDelimiters:
30+
AllowedPatterns: ['expect']
31+
32+
##########
33+
# LAYOUT #
34+
##########
35+
36+
Layout/LineLength:
37+
Max: 150
38+
Exclude:
39+
- ajax-datatables-rails.gemspec
1640

1741
Layout/EmptyLines:
1842
Enabled: false
1943

44+
Layout/EmptyLineBetweenDefs:
45+
Enabled: false
46+
2047
Layout/EmptyLinesAroundClassBody:
2148
Enabled: false
2249

@@ -26,33 +53,33 @@ Layout/EmptyLinesAroundBlockBody:
2653
Layout/EmptyLinesAroundModuleBody:
2754
Enabled: false
2855

29-
Layout/EmptyLineBetweenDefs:
30-
Enabled: false
31-
32-
Metrics/CyclomaticComplexity:
33-
Max: 7
56+
Layout/HashAlignment:
57+
EnforcedColonStyle: table
58+
EnforcedHashRocketStyle: table
3459

35-
Metrics/LineLength:
36-
Enabled: false
60+
##########
61+
# NAMING #
62+
##########
3763

38-
Metrics/BlockLength:
39-
Max: 30
64+
Naming/FileName:
65+
Exclude:
66+
- lib/ajax-datatables-rails.rb
4067

41-
Metrics/MethodLength:
42-
Max: 15
68+
#########
69+
# RSPEC #
70+
#########
4371

44-
Metrics/ClassLength:
45-
Max: 130
72+
RSpec/MultipleExpectations:
73+
Max: 7
4674

47-
Naming/AccessorMethodName:
48-
Enabled: false
75+
RSpec/NestedGroups:
76+
Max: 6
4977

50-
Naming/FileName:
51-
Exclude:
52-
- lib/ajax-datatables-rails.rb
78+
RSpec/ExampleLength:
79+
Max: 9
5380

54-
Style/TrailingCommaInArrayLiteral:
55-
EnforcedStyleForMultiline: comma
81+
RSpec/MultipleMemoizedHelpers:
82+
Max: 6
5683

57-
Style/TrailingCommaInHashLiteral:
58-
EnforcedStyleForMultiline: comma
84+
RSpec/NotToNot:
85+
EnforcedStyle: to_not

Appraisals

+18-25
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,27 @@
11
# frozen_string_literal: true
22

3-
RAILS_VERSIONS = {
4-
'5.2.4' => {
5-
'activerecord-oracle_enhanced-adapter' => '~> 5.2.0',
6-
'sqlite3' => '~> 1.3.0',
7-
'mysql2' => '',
8-
'ruby-oci8' => '',
9-
},
10-
'6.0.3' => {
11-
'activerecord-oracle_enhanced-adapter' => '~> 6.0.0',
12-
'sqlite3' => '~> 1.4.0',
13-
'mysql2' => '',
14-
'ruby-oci8' => '',
15-
},
16-
'6.1.0' => {
17-
'activerecord-oracle_enhanced-adapter' => '~> 6.1.0',
18-
'sqlite3' => '~> 1.4.0',
19-
'mysql2' => '',
20-
'ruby-oci8' => '',
21-
},
22-
}.freeze
3+
require 'yaml'
234

24-
RAILS_VERSIONS.each do |version, gems|
5+
rails_versions = YAML.load(File.read('appraisal.yml'))
6+
7+
rails_versions.each do |version, gems|
258
appraise "rails_#{version}" do
269
gem 'rails', version
27-
gems.each do |name, gem_version|
28-
if gem_version.empty?
29-
gem name
10+
gems.each do |name, opts|
11+
if opts['install_if']
12+
install_if opts['install_if'] do
13+
if opts['version'].empty?
14+
gem name
15+
else
16+
gem name, opts['version']
17+
end
18+
end
3019
else
31-
gem name, gem_version
20+
if opts['version'].empty?
21+
gem name
22+
else
23+
gem name, opts['version']
24+
end
3225
end
3326
end
3427
end

0 commit comments

Comments
 (0)