Skip to content

Add mysql8

Add mysql8 #101

Workflow file for this run

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_test_execution_conditions:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: xt0rted/block-autosquash-commits-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
rspec:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- 3.0.6
- 3.1.4
mysql:
# TODO: skip old env
# - 5.6
# - 5.7
- 8.0.28
needs:
- check_test_execution_conditions
services:
mysql:
image: mysql:${{ matrix.mysql }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup MySQL variables
run: |
version=`echo ${{ matrix.mysql }} | awk -F. '{printf "%d%03d", $1, $2}'`
# 8.0 or later
if (( 8000 <= version )); then
# https://blog.n-z.jp/blog/2021-02-20-github-actions-services-mysqld-option.html
touch test.cnf
(
echo '[mysqld]';
echo 'default_authentication_plugin=mysql_native_password';
echo 'log_bin_trust_function_creators=ON';
) > test.cnf
docker cp ./test.cnf ${{ job.services.mysql.id }}:/etc/mysql/conf.d/
docker restart ${{ job.services.mysql.id }}
for sleep in 0 ${WAITS:- 1 2 4 8 15 25 100}; do
sleep "$sleep"
health_status=`docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" ${{ job.services.mysql.id }}`
if [ 'starting' != "$health_status" ]; then
exit 0
fi
done
exit 1
fi
- name: Run RSpec for ${{ matrix.mysql }}
run: bundle exec rake spec`echo ${{ matrix.mysql }} | awk -F. '{print $1"_"$2}'`
env:
MYSQL_HOST: 127.0.0.1