Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: GitHub Actions: Add DB server MySQL, DB client MariaDB case. #1186

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
jobs:
build:
name: >-
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }} ${{ matrix.db-client || '' }}
# 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 }}
Expand All @@ -26,6 +26,7 @@ jobs:
- 2.2
- 2.1
db: ['']
db-client: [null]
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}
Expand All @@ -36,6 +37,7 @@ jobs:
- {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-20.04, ruby: 2.4, db: mysql80, db-client: mariadb, 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.
Expand All @@ -60,6 +62,10 @@ jobs:
- run: bundle install --without development
- if: matrix.db != ''
run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
- if: matrix.db-client != null
run: echo 'DB_CLIENT=${{ matrix.db-client }}' >> $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 compile
- run: ldd lib/mysql2/mysql2.so
- run: bundle exec rake
2 changes: 1 addition & 1 deletion ci/mysql80.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ apt-key add support/5072E1F5.asc
wget -q --spider http://repo.mysql.com/apt/ubuntu/dists/$(lsb_release -cs)/mysql-8.0
add-apt-repository 'http://repo.mysql.com/apt/ubuntu mysql-8.0'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev
apt-get install -qq mysql-server
8 changes: 8 additions & 0 deletions ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CHANGED_PASSWORD=false
# https://stackoverflow.com/questions/56052177/
CHANGED_PASSWORD_BY_RECREATE=false

echo "DB: ${DB-}, DB_CLIENT: ${DB_CLIENT-}"

# Install the default used DB if DB is not set.
if [[ -n ${GITHUB_ACTIONS-} && -z ${DB-} ]]; then
if command -v lsb_release > /dev/null; then
Expand Down Expand Up @@ -41,6 +43,12 @@ fi
# Install MySQL 8.0 if DB=mysql80
if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
sudo bash ci/mysql80.sh
if [[ -n ${DB_CLIENT-} && x$DB_CLIENT =~ ^xmariadb ]]; then
sudo apt-get install -qq libmariadb-dev-compat
else
sudo apt-get install -qq libmysqlclient-dev
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the logic to install libmysqlclient-dev or libmariadb-dev-compat from mysql80.sh to here. Because the environment variable DB_CLIENT is not available in the sudo bash.

CHANGED_PASSWORD=true
fi

Expand Down