Launch PostgreSQL database ourselves under macOS

It is installed there but not started by default, so just launch it
ourselves.

Note that we must not use PGHOST etc variables under Mac, as the server
seems to be configured to only listen on the local socket by default, so
don't define them globally and do it only for Linux manually instead.
This commit is contained in:
Vadim Zeitlin
2021-03-19 13:54:22 +01:00
parent 5c75f758b6
commit 01b2ebdce3
2 changed files with 20 additions and 4 deletions

View File

@@ -69,10 +69,6 @@ jobs:
env:
SOCI_CI: true
SOCI_CI_BACKEND: ${{ matrix.backend }}
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: Password12!
SOCI_MYSQL_ROOT_PASSWORD: root
steps:
@@ -89,6 +85,20 @@ jobs:
set_env_var SOCI_CI_BRANCH $GITHUB_REF
set_env_var SOCI_SOURCE_DIR $GITHUB_WORKSPACE
set_env_var SOCI_SOURCE_DIR `pwd`
case "${{runner.os}}" in
Linux)
set_env_var PGHOST localhost
set_env_var PGPORT 5432
set_env_var PGUSER postgres
set_env_var PGPASSWORD 'Password12!'
;;
macOS)
set_env_var PGDATA /usr/local/var/postgres
;;
esac
if [ "${{matrix.no_boost}}" = true ]; then
set_env_var WITH_BOOST OFF
fi

View File

@@ -5,5 +5,11 @@
#
source ${SOCI_SOURCE_DIR}/scripts/ci/common.sh
if [ $(uname) = Darwin ]; then
pg_ctl start
pg_isready --timeout=60
createuser --superuser postgres
fi
psql --version
psql -c 'create database soci_test;' -U postgres