Skip to content

Commit 0bb9aeb

Browse files
authored
Merge branch 'master' into apply-manlon-patches
2 parents 68092a2 + b2b6d7b commit 0bb9aeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2082
-541
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.bundle
2+
Gemfile.lock
3+
spec/configuration.yml
4+
spec/my.cnf
5+
tmp
6+
vendor

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
name: >-
6+
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
7+
runs-on: ${{ matrix.os }}
8+
continue-on-error: ${{ matrix.allow-failure || false }}
9+
strategy:
10+
matrix:
11+
include:
12+
# Ruby 3.x on Ubuntu 22.04 LTS (latest at this time)
13+
- {os: ubuntu-22.04, ruby: 'head', db: mysql80}
14+
- {os: ubuntu-22.04, ruby: '3.3', db: mysql80}
15+
- {os: ubuntu-22.04, ruby: '3.2', db: mysql80}
16+
- {os: ubuntu-22.04, ruby: '3.1', db: mysql80}
17+
- {os: ubuntu-22.04, ruby: '3.0', db: mysql80}
18+
19+
# Ruby 2.x on Ubuntu 20.04 LTS
20+
- {os: ubuntu-20.04, ruby: '2.7', db: mysql80}
21+
- {os: ubuntu-20.04, ruby: '2.6', db: mysql80}
22+
- {os: ubuntu-20.04, ruby: '2.5', db: mysql80}
23+
- {os: ubuntu-20.04, ruby: '2.4', db: mysql80}
24+
- {os: ubuntu-20.04, ruby: '2.3', db: mysql80}
25+
- {os: ubuntu-20.04, ruby: '2.2', db: mysql80}
26+
- {os: ubuntu-20.04, ruby: '2.1', db: mysql80}
27+
- {os: ubuntu-20.04, ruby: '2.0', db: mysql80}
28+
29+
# db: on Linux, ci/setup.sh installs the specified packages
30+
# db: on MacOS, installs a Homebrew package use "[email protected]" to specify a version
31+
32+
- {os: ubuntu-22.04, ruby: '3.0', db: mariadb10.11}
33+
- {os: ubuntu-22.04, ruby: '2.7', db: mariadb10.11}
34+
- {os: ubuntu-22.04, ruby: '3.0', db: mariadb10.6}
35+
- {os: ubuntu-20.04, ruby: '2.7', db: mariadb10.6}
36+
- {os: ubuntu-20.04, ruby: '2.7', db: mysql80}
37+
- {os: ubuntu-18.04, ruby: '2.7', db: mysql57}
38+
39+
# TODO - Windows CI
40+
# - {os: windows-2022, ruby: '3.2', db: mysql80}
41+
# - {os: windows-2022, ruby: '2.7', db: mysql80}
42+
43+
# Allow failure due to this issue:
44+
# https://github.com/brianmario/mysql2/issues/1194
45+
- {os: macos-latest, ruby: '2.6', db: mariadb, ssl: [email protected], allow-failure: true}
46+
- {os: macos-latest, ruby: '2.6', db: mysql, ssl: [email protected], allow-failure: true}
47+
# On the fail-fast: true, it cancels all in-progress jobs
48+
# if any matrix job fails, which we don't want.
49+
fail-fast: false
50+
env:
51+
BUNDLE_WITHOUT: development
52+
# reduce MacOS CI time, don't need to clean a runtime that isn't saved
53+
HOMEBREW_NO_INSTALL_CLEANUP: 1
54+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
55+
steps:
56+
- uses: actions/checkout@v3
57+
- uses: ruby/setup-ruby@v1
58+
with:
59+
ruby-version: ${{ matrix.ruby }}
60+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
61+
- if: runner.os == 'Linux' || runner.os == 'macOS'
62+
run: sudo echo "127.0.0.1 mysql2gem.example.com" | sudo tee -a /etc/hosts
63+
- if: runner.os == 'Windows'
64+
run: echo "127.0.0.1 mysql2gem.example.com" | tee -a C:/Windows/System32/drivers/etc/hosts
65+
- run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
66+
- run: bash ci/setup.sh
67+
# Set the verbose option in the Makefile to print compiling command lines.
68+
- run: echo "MAKEFLAGS=V=1" >> $GITHUB_ENV
69+
- if: matrix.ssl
70+
run: echo "rake_spec_opts=--with-openssl-dir=$(brew --prefix ${{ matrix.ssl }})" >> $GITHUB_ENV
71+
- run: bundle exec rake spec -- $rake_spec_opts

.github/workflows/container.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Test Linux distributions which do not exist on GitHub Actions
2+
# by the containers.
3+
name: Container
4+
on: [push, pull_request]
5+
jobs:
6+
build:
7+
name: >-
8+
${{ matrix.distro }} ${{ matrix.image }} ${{ matrix.name_extra || '' }}
9+
runs-on: ubuntu-20.04 # focal
10+
continue-on-error: ${{ matrix.allow-failure || false }}
11+
strategy:
12+
matrix:
13+
include:
14+
# CentOS 7 system Ruby is the fixed version 2.0.0.
15+
- {distro: centos, image: 'centos:7', name_extra: 'ruby 2.0.0'}
16+
# Fedora latest stable version
17+
- {distro: fedora, image: 'fedora:latest'}
18+
# Fedora development version
19+
- {distro: fedora, image: 'fedora:rawhide', ssl_cert_dir: '/tmp/mysql2'}
20+
# On the fail-fast: true, it cancels all in-progress jobs
21+
# if any matrix job fails unlike Travis fast_finish.
22+
fail-fast: false
23+
steps:
24+
- uses: actions/checkout@v3
25+
- run: docker build -t mysql2 -f ci/Dockerfile_${{ matrix.distro }} --build-arg IMAGE=${{ matrix.image }} .
26+
# Add the "--cap-add=... --security-opt seccomp=..." options
27+
# as a temporary workaround to avoid the following issue
28+
# in the Fedora >= 34 containers.
29+
# https://bugzilla.redhat.com/show_bug.cgi?id=1900021
30+
- run: |
31+
docker run \
32+
--add-host=mysql2gem.example.com:127.0.0.1 \
33+
-t \
34+
-e TEST_RUBY_MYSQL2_SSL_CERT_DIR="${{ matrix.ssl_cert_dir || '' }}" \
35+
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
36+
mysql2

.github/workflows/rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: RuboCop
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
env:
9+
BUNDLE_WITHOUT: development
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Ruby 2.6
13+
uses: ruby/setup-ruby@v1
14+
with:
15+
ruby-version: 2.6
16+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
17+
- name: Run RuboCop
18+
run: bundle exec rubocop

.rubocop.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ inherit_from: .rubocop_todo.yml
22

33
AllCops:
44
TargetRubyVersion: 2.0
5+
SuggestExtensions: false
6+
NewCops: disable
57

68
DisplayCopNames: true
79
Exclude:
@@ -12,16 +14,22 @@ AllCops:
1214
Layout/CaseIndentation:
1315
EnforcedStyle: end
1416

15-
Layout/IndentHash:
17+
Layout/FirstHashElementIndentation:
1618
EnforcedStyle: consistent
1719

18-
Lint/EndAlignment:
20+
Layout/EndAlignment:
1921
EnforcedStyleAlignWith: variable
2022

23+
Layout/HashAlignment:
24+
EnforcedHashRocketStyle: table
25+
2126
Style/TrailingCommaInArguments:
2227
EnforcedStyleForMultiline: consistent_comma
2328

24-
Style/TrailingCommaInLiteral:
29+
Style/TrailingCommaInArrayLiteral:
30+
EnforcedStyleForMultiline: consistent_comma
31+
32+
Style/TrailingCommaInHashLiteral:
2533
EnforcedStyleForMultiline: consistent_comma
2634

2735
Style/TrivialAccessors:

.rubocop_todo.yml

Lines changed: 104 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,167 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2017-11-25 19:54:28 -0500 using RuboCop version 0.50.0.
3+
# on 2022-05-30 13:48:55 UTC using RuboCop version 1.30.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 3
10-
# Cop supports --auto-correct.
11-
# Configuration parameters: EnforcedStyle, SupportedStyles.
12-
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
13-
Layout/IndentHeredoc:
10+
# This cop supports safe autocorrection (--autocorrect).
11+
Layout/HeredocIndentation:
1412
Exclude:
1513
- 'support/ruby_enc_to_mysql.rb'
1614
- 'tasks/compile.rake'
1715

1816
# Offense count: 2
17+
# Configuration parameters: AllowedMethods.
18+
# AllowedMethods: enums
19+
Lint/ConstantDefinitionInBlock:
20+
Exclude:
21+
- 'spec/mysql2/client_spec.rb'
22+
- 'tasks/rspec.rake'
23+
24+
# Offense count: 1
25+
Lint/MissingSuper:
26+
Exclude:
27+
- 'lib/mysql2/em.rb'
28+
29+
# Offense count: 2
30+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
1931
Metrics/AbcSize:
20-
Max: 90
32+
Max: 94
2133

22-
# Offense count: 31
23-
# Configuration parameters: CountComments, ExcludedMethods.
34+
# Offense count: 34
35+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
36+
# IgnoredMethods: refine
2437
Metrics/BlockLength:
25-
Max: 850
38+
Max: 592
2639

2740
# Offense count: 1
2841
# Configuration parameters: CountBlocks.
2942
Metrics/BlockNesting:
3043
Max: 5
3144

3245
# Offense count: 1
33-
# Configuration parameters: CountComments.
46+
# Configuration parameters: CountComments, CountAsOne.
3447
Metrics/ClassLength:
35-
Max: 125
48+
Max: 135
3649

3750
# Offense count: 3
51+
# Configuration parameters: IgnoredMethods.
3852
Metrics/CyclomaticComplexity:
39-
Max: 30
40-
41-
# Offense count: 313
42-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
43-
# URISchemes: http, https
44-
Metrics/LineLength:
45-
Max: 232
53+
Max: 34
4654

4755
# Offense count: 6
48-
# Configuration parameters: CountComments.
56+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
4957
Metrics/MethodLength:
5058
Max: 57
5159

5260
# Offense count: 2
61+
# Configuration parameters: IgnoredMethods.
5362
Metrics/PerceivedComplexity:
54-
Max: 27
63+
Max: 32
5564

56-
# Offense count: 3
57-
# Configuration parameters: Blacklist.
58-
# Blacklist: END, (?-mix:EO[A-Z]{1})
65+
# Offense count: 2
66+
# Configuration parameters: ForbiddenDelimiters.
67+
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
5968
Naming/HeredocDelimiterNaming:
6069
Exclude:
6170
- 'tasks/compile.rake'
6271

63-
# Offense count: 10
72+
# Offense count: 1
73+
# This cop supports unsafe autocorrection (--autocorrect-all).
74+
Style/CaseLikeIf:
75+
Exclude:
76+
- 'ext/mysql2/extconf.rb'
77+
78+
# Offense count: 8
79+
# Configuration parameters: AllowedConstants.
6480
Style/Documentation:
6581
Exclude:
6682
- 'spec/**/*'
6783
- 'test/**/*'
6884
- 'benchmark/active_record.rb'
6985
- 'benchmark/allocations.rb'
70-
- 'benchmark/query_with_mysql_casting.rb'
7186
- 'lib/mysql2.rb'
7287
- 'lib/mysql2/client.rb'
7388
- 'lib/mysql2/em.rb'
7489
- 'lib/mysql2/error.rb'
7590
- 'lib/mysql2/result.rb'
7691
- 'lib/mysql2/statement.rb'
7792

78-
# Offense count: 14
93+
# Offense count: 6
94+
# This cop supports safe autocorrection (--autocorrect).
95+
Style/ExpandPathArguments:
96+
Exclude:
97+
- 'ext/mysql2/extconf.rb'
98+
- 'mysql2.gemspec'
99+
- 'spec/mysql2/client_spec.rb'
100+
- 'support/mysql_enc_to_ruby.rb'
101+
- 'tasks/compile.rake'
102+
103+
# Offense count: 15
79104
# Configuration parameters: AllowedVariables.
80105
Style/GlobalVars:
81106
Exclude:
82107
- 'ext/mysql2/extconf.rb'
83108

84-
# Offense count: 17
85-
# Cop supports --auto-correct.
86-
# Configuration parameters: Strict.
109+
# Offense count: 8
110+
# This cop supports safe autocorrection (--autocorrect).
111+
Style/IfUnlessModifier:
112+
Exclude:
113+
- 'lib/mysql2.rb'
114+
- 'lib/mysql2/client.rb'
115+
- 'spec/mysql2/client_spec.rb'
116+
117+
# Offense count: 1
118+
# This cop supports safe autocorrection (--autocorrect).
119+
# Configuration parameters: AllowMethodComparison.
120+
Style/MultipleComparison:
121+
Exclude:
122+
- 'lib/mysql2/client.rb'
123+
124+
# Offense count: 18
125+
# This cop supports safe autocorrection (--autocorrect).
126+
# Configuration parameters: Strict, AllowedNumbers.
87127
Style/NumericLiterals:
88128
MinDigits: 20
89129

90-
# Offense count: 726
91-
# Cop supports --auto-correct.
92-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
130+
# Offense count: 14
131+
# This cop supports unsafe autocorrection (--autocorrect-all).
132+
# Configuration parameters: Mode.
133+
Style/StringConcatenation:
134+
Exclude:
135+
- 'benchmark/active_record.rb'
136+
- 'benchmark/active_record_threaded.rb'
137+
- 'benchmark/allocations.rb'
138+
- 'benchmark/escape.rb'
139+
- 'benchmark/query_with_mysql_casting.rb'
140+
- 'benchmark/query_without_mysql_casting.rb'
141+
- 'benchmark/sequel.rb'
142+
- 'benchmark/setup_db.rb'
143+
- 'ext/mysql2/extconf.rb'
144+
- 'lib/mysql2/client.rb'
145+
- 'tasks/compile.rake'
146+
147+
# Offense count: 782
148+
# This cop supports safe autocorrection (--autocorrect).
149+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
93150
# SupportedStyles: single_quotes, double_quotes
94151
Style/StringLiterals:
95152
Enabled: false
153+
154+
# Offense count: 1
155+
# This cop supports safe autocorrection (--autocorrect).
156+
# Configuration parameters: WordRegex.
157+
# SupportedStyles: percent, brackets
158+
Style/WordArray:
159+
EnforcedStyle: percent
160+
MinSize: 4
161+
162+
# Offense count: 32
163+
# This cop supports safe autocorrection (--autocorrect).
164+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
165+
# URISchemes: http, https
166+
Layout/LineLength:
167+
Max: 232

0 commit comments

Comments
 (0)