Test MySQL centrally in fancy

This commit is contained in:
def 2021-11-28 01:41:10 +01:00
parent f5d59e8719
commit 04594397ca
2 changed files with 18 additions and 2 deletions

View file

@ -63,7 +63,17 @@ jobs:
- name: Prepare Linux (fancy) - name: Prepare Linux (fancy)
if: contains(matrix.os, 'ubuntu') && matrix.fancy if: contains(matrix.os, 'ubuntu') && matrix.fancy
run: | run: |
sudo apt-get install libmariadbclient-dev libwebsockets-dev -y sudo apt-get install libmariadbclient-dev libwebsockets-dev mariadb-server -y
sudo rm -rf /var/lib/mysql/
sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql/
cd /usr; sudo /usr/bin/mysqld_safe --datadir='/var/lib/mysql/' --no-watch
sleep 10
sudo mariadb <<EOF
CREATE DATABASE ddnet;
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
FLUSH PRIVILEGES;
EOF
- name: Prepare macOS - name: Prepare macOS
if: contains(matrix.os, 'macOS') if: contains(matrix.os, 'macOS')
@ -120,7 +130,7 @@ jobs:
run: | run: |
mkdir fancy mkdir fancy
cd fancy cd fancy
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DANTIBOT=ON -DMYSQL=ON -DWEBSOCKETS=ON .. ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DANTIBOT=ON -DMYSQL=ON -DWEBSOCKETS=ON -DMYSQL=ON ..
${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target everything ${{ matrix.build-args }} ${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target everything ${{ matrix.build-args }}
- name: Test fancy - name: Test fancy
if: matrix.fancy if: matrix.fancy

View file

@ -8,6 +8,12 @@
#include <sqlite3.h> #include <sqlite3.h>
#if defined(CONF_MYSQL) #if defined(CONF_MYSQL)
// For MySQL this setup is required on localhost:
// CREATE DATABASE ddnet;
// CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
// GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
// FLUSH PRIVILEGES;
int DummyMysqlInit = (MysqlInit(), 1); int DummyMysqlInit = (MysqlInit(), 1);
#endif #endif