Files
soci/scripts/ci/before_build_postgresql.sh
T
Vadim Zeitlin 698495c33b Install PostgreSQL ourselves in macOS CI workflow
It used to be part of macos-12 image but is not present in the later
ones for whatever reason.

Installing postgresql formula using brew already initializes the
database cluster but does it in a non-default directory, so adjust
PGDATA definition accordingly and remove "pg_ctl init" which is not
needed any longer.
2024-10-16 15:50:56 +02:00

31 lines
741 B
Bash
Executable File

#!/usr/bin/env bash
# Sets up environment for SOCI backend PostgreSQL in CI builds
#
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ${SOCI_SOURCE_DIR}/scripts/ci/common.sh
case "$(uname)" in
Linux)
sudo service postgresql start
pg_isready --timeout=60
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'Password12!';"
;;
Darwin)
pg_ctl start
pg_isready --timeout=60
createuser --superuser postgres
;;
*)
echo 'Unknown OS, PostgreSQL not available'
exit 1
esac
psql --version
psql -c 'create database soci_test;' -U postgres
echo 'Testing connection to the database:'
psql -c 'select user;' -U postgres -d soci_test