Skip to content

Commit

Permalink
more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Sep 11, 2024
1 parent 5d63dba commit 6766f52
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions .github/actions/setup-postgres-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ runs:
steps:
- shell: bash
run: |
# The Windows runner has some PostgreSQL environment variables set
# that may confuse users since they may be irrelevant to the
# PostgreSQL server we're using. Since GitHub actions does not
# support unsetting environment variables, the best we can do is to
# clear their values in order to indicate they must not be used.
# for name in "PGROOT" "PGDATA" "PGBIN" "PGUSER" "PGPASSWORD"; do
# echo "$name=" >> $GITHUB_ENV
# done
choco upgrade postgresql16 \
--params "/Password:password" \
--ia "--enable-components server,commandlinetools --extract-only 1" \
Expand All @@ -28,24 +19,39 @@ runs:
echo "$PG_BINDIR" >> $GITHUB_PATH
echo "PQ_LIB_DIR=$PG_LIBDIR" >> $GITHUB_ENV
PGBIN=PG_BINDIR
PGROOT="%ProgramFiles%\PostgreSQL\16"
PGDATA="%ProgramFiles%\PostgreSQL\16\data"
PGBIN=$PG_BINDIR
PGROOT=$(dirname $PG_BINDIR)
PGDATA="$PGROOT/data"
echo "PGBIN=$PGBIN" >> $GITHUB_ENV
echo "PGROOT=$PGROOT" >> $GITHUB_ENV
echo "PGDATA=$PGDATA" >> $GITHUB_ENV
echo "listing contents of PGROOT: $PGROOT"
echo "PGROOT:$PGROOT"
ls $PGROOT
echo "registering service using $PGBIN\pg_ctl.exe"
"$PGBIN\pg_ctl.exe" register -N "postgresql16" -D "%ProgramData%\data" -S auto
"$PGBIN\initdb.exe -D "%ProgramFiles%\PostgreSQL\16\data"
echo "PGBIN:$PGBIN"
ls $PGBIN
echo "PGDATA:$PGDATA"
mkdir $PGDATA
ls $PGDATA
echo "registering service using $PGBIN/pg_ctl.exe"
"$PGBIN/pg_ctl.exe" register -N "postgresql16" -D "$PGDATA" -S auto
- shell: pwsh
run: |
# $pgService = Get-Service -Name postgresql16
# Set-Service -InputObject $pgService -Status running -StartupType automatic
Get-Service -Name postgresql*
$pgReady = Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
$exitCode = $pgReady.ExitCode
if ($exitCode -ne 0) {
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
exit $exitCode
}
$pgService = Get-Service -Name postgresql16
Set-Service -InputObject $pgService -Status running -StartupType automatic
# Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
$env:Path += ";$env:PGBIN"
bash ${{ github.action_path }}/setup_db.sh

0 comments on commit 6766f52

Please sign in to comment.