diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 2215dfc9..32bf025e 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -6,11 +6,10 @@ runs: steps: - name: Start the postgres service - run: | - sudo systemctl start postgresql.service - pg_isready + run: sudo systemctl start postgresql.service shell: bash - name: Configure the database - run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh + run: sudo -u postgres bash setup_postgres_linux.sh shell: bash + working-directory: ./.github/scripts diff --git a/.github/scripts/setup_postgres_linux.sh b/.github/scripts/setup_postgres_linux.sh index de59bf0f..3a12f105 100755 --- a/.github/scripts/setup_postgres_linux.sh +++ b/.github/scripts/setup_postgres_linux.sh @@ -11,24 +11,6 @@ PGPORT="${PGPORT:-5432}" export PGPORT PGHOST="${PGHOST:-localhost}" -function connect_circle() { - # try to handle circleci/docker oddness - let rc=1 - while [[ $rc -eq 1 ]]; do - nc -z ${PGHOST} ${PGPORT} - let rc=$? - done - if [[ $rc -ne 0 ]]; then - echo "Fatal: Could not connect to $PGHOST" - exit 1 - fi -} - -# appveyor doesn't have 'nc', but it also doesn't have these issues -if [[ -n $CIRCLECI ]]; then - connect_circle -fi - for i in {1..10}; do if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then break @@ -38,6 +20,8 @@ for i in {1..10}; do sleep 2; done; +echo "Postgres is running" + createdb dbt psql -c "CREATE ROLE root WITH PASSWORD 'password';" psql -c "ALTER ROLE root WITH LOGIN;"