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 Jan 19, 2023
1 parent a89fd5b commit a4d9300
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 58 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
32 changes: 4 additions & 28 deletions .github/workflows/build.yml → .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,49 +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'
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: 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, ssl: [email protected], allow-failure: true}
- {os: macos-latest, ruby: '2.6', db: mariadb@10.6, ssl: [email protected], allow-failure: true}
# MySQL latest version
# Allow failure due to the issue #1194.
- {os: macos-latest, ruby: '2.6', db: mysql, ssl: [email protected], allow-failure: true}
- {os: macos-latest, ruby: '2.6', db: mysql@8, ssl: [email protected], 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
42 changes: 42 additions & 0 deletions .github/workflows/ubuntu-focal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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'
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
38 changes: 38 additions & 0 deletions .github/workflows/ubuntu-jammy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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:
- 'head'
- '3.2'
- '3.1'
- '3.0'
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}
# 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

0 comments on commit a4d9300

Please sign in to comment.