Skip to content

Commit

Permalink
Merge remote-tracking branch 'brianmario/master' into force_latin1_to…
Browse files Browse the repository at this point in the history
…_utf8
  • Loading branch information
jeremy committed Jan 10, 2022
2 parents 7a8cb8b + 25c42c7 commit d388a11
Show file tree
Hide file tree
Showing 47 changed files with 1,340 additions and 426 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.bundle
Gemfile.lock
spec/configuration.yml
spec/my.cnf
tmp
vendor
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build
on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
# Run all the tests on the new environment as much as possible.
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow-failure || false }}
strategy:
matrix:
os:
# Use ubuntu-18.04 instead of ubuntu-20.04 temporarily, due to a failing test on mysql 8.0.
# https://github.com/brianmario/mysql2/issues/1165
# - ubuntu-20.04 # focal
- ubuntu-18.04 # bionic
# - ubuntu-16.04 # xenial
ruby:
- '3.0'
- 2.7
- 2.6
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1
db: ['']
include:
# Allow failure due to Mysql2::Error: Unknown system variable 'session_track_system_variables'.
- {os: ubuntu-16.04, ruby: 2.4, db: mariadb10.0, allow-failure: true}
# Comment out due to ci/setup.sh stucking.
# - {os: ubuntu-18.04, ruby: 2.4, db: mariadb10.1}
# Allow failure due to the issue #965, #1165.
- {os: ubuntu-20.04, ruby: 2.4, db: mariadb10.3, allow-failure: true}
- {os: ubuntu-18.04, ruby: 2.4, db: mysql57}
# Allow failure due to the issue #1165.
- {os: ubuntu-20.04, ruby: 2.4, db: mysql80, allow-failure: true}
- {os: ubuntu-18.04, ruby: 'head', db: '', allow-failure: true}
# db: A DB's brew package name in macOS case.
# Set a name "db: '[email protected]'" when using an old version.
# MariaDB lastet version
# Allow failure due to the following test failures that rarely happens.
# https://github.com/brianmario/mysql2/issues/1194
- {os: macos-latest, ruby: 2.4, db: mariadb, allow-failure: true}
# MySQL latest version
# Allow failure due to the issue #1165.
- {os: macos-latest, ruby: 2.4, db: mysql, allow-failure: true}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails unlike Travis fast_finish.
fail-fast: false
steps:
- uses: actions/checkout@v2
# https://github.com/ruby/setup-ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install openssl
if: matrix.os == 'macos-latest'
run: |
brew update
brew install openssl
- run: ruby -v
- run: bundle install --without development
- if: matrix.db != ''
run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
- run: sudo echo "127.0.0.1 mysql2gem.example.com" | sudo tee -a /etc/hosts
- run: bash ci/setup.sh
- run: bundle exec rake spec
30 changes: 30 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Test Linux distributions which do not exist on GitHub Actions
# by the containers.
name: Container
on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.distro }} ${{ matrix.image }} ${{ matrix.name_extra || '' }}
runs-on: ubuntu-20.04 # focal
continue-on-error: ${{ matrix.allow-failure || false }}
strategy:
matrix:
include:
# CentOS 7 system Ruby is the fixed version 2.0.0.
- {distro: centos, image: 'centos:7', name_extra: 'ruby 2.0.0'}
# Fedora latest stable version
- {distro: fedora, image: 'fedora:latest'}
# Fedora development version
- {distro: fedora, image: 'fedora:rawhide'}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails unlike Travis fast_finish.
fail-fast: false
steps:
- uses: actions/checkout@v2
- run: docker build -t mysql2 -f ci/Dockerfile_${{ matrix.distro }} --build-arg IMAGE=${{ matrix.image }} .
# Add the "--cap-add=... --security-opt seccomp=..." options
# as a temporary workaround to avoid the following issue
# in the Fedora >= 34 containers.
# https://bugzilla.redhat.com/show_bug.cgi?id=1900021
- run: docker run --add-host=mysql2gem.example.com:127.0.0.1 -t --cap-add=SYS_PTRACE --security-opt seccomp=unconfined mysql2
27 changes: 27 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: RuboCop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.4
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rubocop-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Layout/IndentHeredoc:

# Offense count: 2
Metrics/AbcSize:
Max: 90
Max: 91

# Offense count: 31
# Configuration parameters: CountComments, ExcludedMethods.
Expand All @@ -32,11 +32,11 @@ Metrics/BlockNesting:
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 125
Max: 135

# Offense count: 3
Metrics/CyclomaticComplexity:
Max: 30
Max: 32

# Offense count: 313
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
Expand All @@ -51,7 +51,7 @@ Metrics/MethodLength:

# Offense count: 2
Metrics/PerceivedComplexity:
Max: 27
Max: 29

# Offense count: 3
# Configuration parameters: Blacklist.
Expand Down
53 changes: 5 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
sudo: required
dist: trusty
services: docker
language: ruby
bundler_args: --without benchmarks development
# Pin Rubygems to a working version. Sometimes it breaks upstream. Update now and then.
bundler_args: --without development
before_install:
- gem --version
- gem update --system 2.7.6 --quiet
- gem update bundler
- gem --version
- bash .travis_setup.sh
addons:
hosts:
- mysql2gem.example.com
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
rvm:
- 2.6
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1
- 2.0.0
- ruby-head
- bash ci/setup.sh
matrix:
include:
- rvm: 2.4
Expand Down Expand Up @@ -58,30 +37,8 @@ matrix:
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.4
env: DB=mysql57
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.4
env: DB=mysql80
addons:
hosts:
- mysql2gem.example.com
- os: osx
rvm: 2.4
env: DB=mysql56
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.4
env: DOCKER=centos
before_install: true
install: docker build -t mysql2 -f .travis_Dockerfile_centos .
script: docker run --add-host=mysql2gem.example.com:127.0.0.1 -t mysql2
fast_finish: true
allow_failures:
- rvm: ruby-head
- os: osx
rvm: 2.4
env: DB=mysql56
# Allow failure due to a package repository not found for now.
# https://travis-ci.org/github/brianmario/mysql2/jobs/767276558#L1255
- env: DB=mysql55
23 changes: 0 additions & 23 deletions .travis_Dockerfile_centos

This file was deleted.

13 changes: 0 additions & 13 deletions .travis_centos.sh

This file was deleted.

14 changes: 0 additions & 14 deletions .travis_mysql57.sh

This file was deleted.

14 changes: 0 additions & 14 deletions .travis_mysql80.sh

This file was deleted.

57 changes: 0 additions & 57 deletions .travis_setup.sh

This file was deleted.

Loading

0 comments on commit d388a11

Please sign in to comment.