From ad42cf80f2364e3f95e7cf6e209b16f93ab19b46 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 15 Jan 2024 21:26:55 +0000 Subject: [PATCH] shell?? --- tests/setup-db.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/setup-db.sh b/tests/setup-db.sh index e0a3c1f1..55ee19e0 100755 --- a/tests/setup-db.sh +++ b/tests/setup-db.sh @@ -1,10 +1,12 @@ #!/bin/sh +set -eux + DATABASE=$1 mkdir -p data/config -if [[ "$DATABASE" == "pgsql" ]]; then +if [ "$DATABASE" = "pgsql" ]; then sudo systemctl start postgresql psql --version sudo -u postgres psql -c "SELECT set_config('log_statement', 'all', false);" -U postgres @@ -12,20 +14,20 @@ if [[ "$DATABASE" == "pgsql" ]]; then sudo -u postgres psql -c "CREATE DATABASE shimmie WITH OWNER shimmie;" -U postgres export TEST_DSN="pgsql:user=shimmie;password=shimmie;host=127.0.0.1;dbname=shimmie" fi -if [[ "$DATABASE" == "mysql" ]]; then +if [ "$DATABASE" == "mysql" ]; then sudo systemctl start mysql mysql --version mysql -e "SET GLOBAL general_log = 'ON';" -uroot -proot mysql -e "CREATE DATABASE shimmie;" -uroot -proot export TEST_DSN="mysql:user=root;password=root;host=127.0.0.1;dbname=shimmie" fi -if [[ "$DATABASE" == "sqlite" ]]; then +if [ "$DATABASE" = "sqlite" ]; then sudo apt update && sudo apt-get install -y sqlite3 sqlite3 --version export TEST_DSN="sqlite:data/shimmie.sqlite" fi -if [[ -n "$GITHUB_ENV" ]]; then +if [ -n "$GITHUB_ENV" ]; then echo "TEST_DSN=$TEST_DSN" >> $GITHUB_ENV echo "INSTALL_DSN=$TEST_DSN" >> $GITHUB_ENV fi