Skip to content

Commit

Permalink
CI: update runtime environments
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Dec 29, 2022
1 parent d4469e4 commit 451663e
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test Linux distributions which do not exist on GitHub Actions
# by the containers.
name: Container
name: Fedora and CentOS
on: [push, pull_request]
jobs:
build:
Expand Down
33 changes: 4 additions & 29 deletions .github/workflows/build.yml → .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
name: Build
name: MacOS
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
ruby:
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '2.4'
- '2.3'
- '2.2'
- '2.1'
db: ['']
include:
# Comment out due to ci/setup.sh stucking.
# - {os: ubuntu-18.04, ruby: 2.4, db: mariadb10.1}
- {os: ubuntu-20.04, ruby: '2.4', db: mariadb10.3}
- {os: ubuntu-18.04, ruby: '2.4', db: mysql57}
- {os: ubuntu-20.04, ruby: '2.4', db: mysql80}
- {os: ubuntu-18.04, ruby: 'head', db: ''}
# 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.6', db: mariadb, allow-failure: true}
- {os: macos-latest, ruby: '2.6', db: mariadb@10.6, allow-failure: true}
# MySQL latest version
# Allow failure due to the issue #1194.
- {os: macos-latest, ruby: '2.6', db: mysql, allow-failure: true}
- {os: macos-latest, ruby: '2.6', db: mysql@8, allow-failure: true}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails unlike Travis fast_finish.
# if any matrix job fails, which we don't want.
fail-fast: false
env:
BUNDLE_WITHOUT: development
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/ubuntu-focal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Ubuntu Focal 20.04 with Ruby 2.x
on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow-failure || false }}
strategy:
matrix:
os:
- ubuntu-20.04 # focal
ruby:
- '2.7'
- '2.6'
- '2.5'
- '2.4'
- '2.3'
- '2.2'
- '2.1'
- '2.0'
db: ['']
include:
- {os: ubuntu-20.04, ruby: '2.7', db: mariadb10.6}
- {os: ubuntu-20.04, ruby: '2.7', db: mysql57}
- {os: ubuntu-20.04, ruby: '2.7', db: mysql80}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails, which we don't want.
fail-fast: false
env:
BUNDLE_WITHOUT: development
steps:
- uses: actions/checkout@v3
# https://github.com/ruby/setup-ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- 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
39 changes: 39 additions & 0 deletions .github/workflows/ubuntu-jammy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Ubuntu Jammy 22.04 with Ruby 3.x
on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow-failure || false }}
strategy:
matrix:
os:
- ubuntu-22.04 # jammy
ruby:
- '3.2'
- '3.1'
- '3.0'
db: ['']
include:
- {os: ubuntu-22.04, ruby: '3.0', db: mariadb10.6}
- {os: ubuntu-22.04, ruby: '3.0', db: mysql57}
- {os: ubuntu-22.04, ruby: '3.0', db: mysql80}
- {os: ubuntu-22.04, ruby: 'head', db: ''}
# On the fail-fast: true, it cancels all in-progress jobs
# if any matrix job fails, which we don't want.
fail-fast: false
env:
BUNDLE_WITHOUT: development
steps:
- uses: actions/checkout@v3
# https://github.com/ruby/setup-ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- 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
32 changes: 3 additions & 29 deletions ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,14 @@ if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
CHANGED_PASSWORD=true
fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.0 ]]; then
if [[ -n ${GITHUB_ACTIONS-} ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.0 libmariadb2
CHANGED_PASSWORD_BY_RECREATE=true
else
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
fi
fi

# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.1 ]]; then
if [[ -n ${GITHUB_ACTIONS-} ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.1 libmariadb-dev
CHANGED_PASSWORD_BY_RECREATE=true
else
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
fi
fi

# Install MariaDB 10.2 if DB=mariadb10.2
# NOTE this is a workaround until Travis CI merges a fix to its mariadb addon.
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.2 ]]; then
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.2 libmariadbclient18
fi

# Install MariaDB 10.3 if DB=mariadb10.3
if [[ -n ${GITHUB_ACTIONS-} && -n ${DB-} && x$DB =~ ^xmariadb10.3 ]]; then
# Install MariaDB 10.6 if DB=mariadb10.6
if [[ -n ${GITHUB_ACTIONS-} && -n ${DB-} && x$DB =~ ^xmariadb10.6 ]]; then
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
sudo apt-get purge -y 'mysql-common*' 'mysql-client*' 'mysql-server*'
sudo mv /etc/mysql "/etc/mysql-$(date +%Y%m%d-%H%M%S)"
sudo mv /var/lib/mysql "/var/lib/mysql-$(date +%Y%m%d-%H%M%S)"
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.3 libmariadb-dev
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.6 libmariadb-dev
CHANGED_PASSWORD_BY_RECREATE=true
fi

Expand Down
5 changes: 3 additions & 2 deletions ext/mysql2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def add_ssl_defines(header)
end

# Homebrew openssl
if RUBY_PLATFORM =~ /darwin/ && system("command -v brew")
if RUBY_PLATFORM =~ /darwin/ && system('command -v brew')
openssl_location = `brew --prefix openssl`.strip
$LDFLAGS << " -L#{openssl_location}/lib" if openssl_location
end
Expand All @@ -39,7 +39,8 @@ def add_ssl_defines(header)
# Missing in RBX (https://github.com/rubinius/rubinius/issues/3771)
have_func('rb_wait_for_single_fd')

have_func("rb_enc_interned_str", "ruby.h")
# Ruby 3.0+
have_func('rb_enc_interned_str', 'ruby.h')

# borrowed from mysqlplus
# http://github.com/oldmoe/mysqlplus/blob/master/ext/extconf.rb
Expand Down

0 comments on commit 451663e

Please sign in to comment.