Skip to content

Build Trilogy::Result via constructor #1073

Build Trilogy::Result via constructor

Build Trilogy::Result via constructor #1073

Workflow file for this run

permissions:
contents: read
name: macOS
on:
push:
branches:
- main
tags:
- v*
pull_request:
jobs:
test-mysql:
name: Test (MySQL ${{ matrix.mysql }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
mysql: ["8.0", "8.4", "9.6"]
steps:
- uses: actions/checkout@v6
- name: Setup MySQL
run: |
brew install mysql@${{ matrix.mysql }}
# Apply macOS-specific config if it exists (e.g., 8.4 needs mysql_native_password=ON)
# Homebrew MySQL reads config from $(brew --prefix)/etc/my.cnf
if [[ -f "test/mysql/conf.d/${{ matrix.mysql }}/macos.cnf" ]]; then
cat test/mysql/conf.d/${{ matrix.mysql }}/macos.cnf >> $(brew --prefix)/etc/my.cnf
fi
(unset CI; brew postinstall mysql@${{ matrix.mysql }})
brew services start mysql@${{ matrix.mysql }}
sleep 5
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot -e 'CREATE DATABASE test'
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/caching_sha2_password_user.sql
- name: Build
run: CFLAGS="-I$(brew --prefix openssl@1.1)/include" LDFLAGS="-L$(brew --prefix openssl@1.1)/lib" make all test/test
- name: test
run: test/test
test-mariadb:
name: Test (MariaDB ${{ matrix.mariadb }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
mariadb: ["10.6", "10.11", "11.4", "11.8"]
steps:
- uses: actions/checkout@v6
- name: Setup MariaDB
run: |
brew install mariadb@${{ matrix.mariadb }}
# Apply macOS-specific config if it exists
if [[ -f "test/mariadb/conf.d/${{ matrix.mariadb }}/macos.cnf" ]]; then
cat test/mariadb/conf.d/${{ matrix.mariadb }}/macos.cnf >> $(brew --prefix)/etc/my.cnf
fi
(unset CI; brew postinstall mariadb@${{ matrix.mariadb }})
brew services start mariadb@${{ matrix.mariadb }}
sleep 5
# MariaDB uses unix_socket auth for root by default, so use sudo
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e 'CREATE DATABASE IF NOT EXISTS test'
# Create a test user for C tests (root uses unix_socket which doesn't work for TCP)
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e "CREATE USER IF NOT EXISTS 'trilogy'@'127.0.0.1' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON test.* TO 'trilogy'@'127.0.0.1';"
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e "CREATE USER IF NOT EXISTS 'trilogy'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON test.* TO 'trilogy'@'localhost';"
- name: Build
run: CFLAGS="-I$(brew --prefix openssl@1.1)/include" LDFLAGS="-L$(brew --prefix openssl@1.1)/lib" make all test/test
- name: test
env:
MYSQL_HOST: "127.0.0.1"
MYSQL_USER: trilogy
MYSQL_PASS: password
MYSQL_DB: test
run: test/test
test-ruby-mysql:
name: Test Ruby (MySQL ${{ matrix.mysql }}, Ruby ${{ matrix.ruby }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- mysql: "9.6"
ruby: "3.0"
- mysql: "9.6"
ruby: "4.0"
- mysql: "8.0"
ruby: "4.0"
- mysql: "8.4"
ruby: "4.0"
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Setup MySQL
env:
MYSQL_VERSION: ${{ matrix.mysql }}
run: |
brew install mysql@${{ matrix.mysql }}
# Apply macOS-specific config if it exists (e.g., 8.4 needs mysql_native_password=ON)
# Homebrew MySQL reads config from $(brew --prefix)/etc/my.cnf
if [[ -f "test/mysql/conf.d/${{ matrix.mysql }}/macos.cnf" ]]; then
cat test/mysql/conf.d/${{ matrix.mysql }}/macos.cnf >> $(brew --prefix)/etc/my.cnf
fi
(unset CI; brew postinstall mysql@${{ matrix.mysql }})
brew services start mysql@${{ matrix.mysql }}
sleep 5
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot -e 'CREATE DATABASE test'
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/caching_sha2_password_user.sql
# mysql_native_password plugin was removed in MySQL 9.x
if [[ ! "${{ matrix.mysql }}" =~ ^9 ]]; then
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot -e "CREATE USER 'native'@'%'; GRANT ALL PRIVILEGES ON test.* TO 'native'@'%'; ALTER USER 'native'@'%' IDENTIFIED WITH mysql_native_password BY 'password';"
fi
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/x509_user.sql
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/cleartext_user.sql
- name: Install dependencies
run: |
cd contrib/ruby
bundle config set without benchmark
bundle install
- name: Run tests
run: |
cd contrib/ruby
bundle exec rake
test-ruby-mariadb:
name: Test Ruby (MariaDB ${{ matrix.mariadb }}, Ruby ${{ matrix.ruby }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
mariadb: ["10.6", "11.8"]
ruby: ["4.0"]
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Setup MariaDB
env:
MARIADB_VERSION: ${{ matrix.mariadb }}
run: |
brew install mariadb@${{ matrix.mariadb }}
# Apply macOS-specific config if it exists
if [[ -f "test/mariadb/conf.d/${{ matrix.mariadb }}/macos.cnf" ]]; then
cat test/mariadb/conf.d/${{ matrix.mariadb }}/macos.cnf >> $(brew --prefix)/etc/my.cnf
fi
(unset CI; brew postinstall mariadb@${{ matrix.mariadb }})
brew services start mariadb@${{ matrix.mariadb }}
sleep 5
# MariaDB uses unix_socket auth for root by default, so use sudo
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e 'CREATE DATABASE IF NOT EXISTS test'
# Create a test user that can connect via TCP (root uses unix_socket which doesn't work for TCP)
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e "CREATE USER IF NOT EXISTS 'trilogy'@'127.0.0.1' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'trilogy'@'127.0.0.1' WITH GRANT OPTION;"
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e "CREATE USER IF NOT EXISTS 'trilogy'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'trilogy'@'localhost' WITH GRANT OPTION;"
# MariaDB uses IDENTIFIED VIA instead of IDENTIFIED WITH
sudo $(brew --prefix mariadb@${{ matrix.mariadb }})/bin/mariadb -e "CREATE USER IF NOT EXISTS 'native'@'%'; GRANT ALL PRIVILEGES ON test.* TO 'native'@'%'; ALTER USER 'native'@'%' IDENTIFIED VIA mysql_native_password USING PASSWORD('password');"
# Note: x509_user.sql and cleartext_user.sql are not used for MariaDB
# - x509 tests require custom client certificates (not available without generate_keys.sh)
# - cleartext_plugin_server requires auth_test_plugin.so (MySQL-specific)
- name: Install dependencies
run: |
cd contrib/ruby
bundle config set without benchmark
bundle install
- name: Run tests
env:
MYSQL_HOST: "127.0.0.1"
MYSQL_USER: trilogy
MYSQL_PASS: password
run: |
cd contrib/ruby
bundle exec rake