Skip to content

Commit

Permalink
CI: test MariaDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Feb 27, 2025
1 parent 8a260d1 commit 2085453
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ jobs:
backend: Valgrind
runner: ubuntu-24.04
name: Valgrind
- lib_type: shared
backend: MySQL
runner: ubuntu-24.04
mariadb: true
name: MariaDB

runs-on: ${{ matrix.runner }}
name: ${{ format('{0} on {1}', (matrix.name != '' && matrix.name || format('{0} ({1})', matrix.backend, matrix.lib_type)), matrix.runner) }}
Expand Down Expand Up @@ -179,6 +184,9 @@ jobs:
else
set_env_var SOCI_ENABLE_UNITY_BUILD OFF
fi
if [ "${{matrix.mariadb}}" = true ]; then
set_env_var SOCI_MYSQL_USE_MARIADB YES
fi
# Ensure SOCI_CI_BACKEND is always lowercase
set_env_var SOCI_CI_BACKEND "$( echo "$SOCI_CI_BACKEND" | tr '[:upper:]' '[:lower:]' )"
Expand Down
7 changes: 6 additions & 1 deletion scripts/ci/before_build_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ source ${SOCI_SOURCE_DIR}/scripts/ci/common.sh
SOCI_MYSQL_USER=$(id -un)

if [ -n "${SOCI_MYSQL_ROOT_PASSWORD}" ]; then
sudo systemctl start mysql.service
if [[ "$SOCI_MYSQL_USE_MARIADB" = "YES" ]]; then
sudo systemctl start mariadb.service
else
sudo systemctl start mysql.service
fi

SOCI_MYSQL_PASSWORD_OPT="-p${SOCI_MYSQL_ROOT_PASSWORD}"
mysql -u root ${SOCI_MYSQL_PASSWORD_OPT} -e "CREATE USER '${SOCI_MYSQL_USER}';"
fi
Expand Down
16 changes: 16 additions & 0 deletions scripts/ci/install_mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

source "${SOCI_SOURCE_DIR}/scripts/ci/common.sh"

if [[ "$SOCI_MYSQL_USE_MARIADB" = "YES" ]]; then
run_apt purge mysql*

run_apt install mariadb-server

sudo systemctl start mariadb

systemctl status mariadb
else
# We assume that MySQL is already installed
systemctl status mysql
fi

0 comments on commit 2085453

Please sign in to comment.