Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/build-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ jobs:
$psql_opt = "--bindir"
}

if ("$pg_version" -eq "14") {
& "C:\Program Files\PostgreSQL\14\uninstall-postgresql.exe" --mode unattended 2>&1 | Out-Default
Remove-Item -Recurse -Force "C:\Program Files\PostgreSQL\14"
# Uninstall existing PostgreSQL installation in windows-latest (windows-2025) runner
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md#postgresql
if ("$pg_version" -eq "17") {
& "C:\Program Files\PostgreSQL\17\uninstall-postgresql.exe" --mode unattended 2>&1 | Out-Default
Remove-Item -Recurse -Force "C:\Program Files\PostgreSQL\17"
}

"PG_VERSION=$pg_version" >> $env:GITHUB_ENV
Expand Down Expand Up @@ -96,25 +98,39 @@ jobs:
run: |
$ErrorActionPreference = "Stop"

Stop-Service -Name "postgresql$env:X64-$env:PG_VERSION"
$serviceName = "postgresql$env:X64-$env:PG_VERSION"
$pgData = "C:\pgdata"
$pgPort = "55432"

$env:PGPORT = $pgPort
$env:PGHOST = "localhost"
$env:Path = "$env:PG_ROOT\bin;$env:Path"

if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue
& "$env:PG_ROOT\bin\pg_ctl.exe" unregister -N "$serviceName" 2>&1 | Out-Default
Start-Sleep -Seconds 2
}
Remove-Item -Recurse -Force "$pgData" -ErrorAction SilentlyContinue

Copy ".\$env:RELEASE_DIR\temporal_tables.dll" "$env:PG_ROOT\lib"
Copy ".\*.sql" "$env:PG_ROOT\share\extension"
Copy ".\*.control" "$env:PG_ROOT\share\extension"

Set-Content -path pg.pass -value $env:PGPASSWORD -encoding ascii
& "$env:PG_ROOT\bin\initdb.exe" -A md5 -U postgres --pwfile=pg.pass C:\pgdata 2>&1 | Out-Default
& "$env:PG_ROOT\bin\pg_ctl.exe" register -S demand -N "postgresql$env:X64-$env:PG_VERSION" -D c:\pgdata 2>&1 | Out-Default
& "$env:PG_ROOT\bin\initdb.exe" -A md5 -U postgres --pwfile=pg.pass "$pgData" 2>&1 | Out-Default
& "$env:PG_ROOT\bin\pg_ctl.exe" register -S demand -N "$serviceName" -D "$pgData" -o "-p $pgPort" 2>&1 | Out-Default

Start-Service -Name "postgresql$env:X64-$env:PG_VERSION"
Start-Service -Name "$serviceName"

Get-ChildItem "$env:PG_REGRESS"
& "C:\Program Files\PostgreSQL\17\lib\pgxs\src\test\regress\pg_regress.exe" --help 2>&1 | Out-Default

& "$env:PG_REGRESS" "$env:PSQL_OPT=$env:PG_ROOT\bin" --dbname=pl_regression install no_system_period invalid_system_period no_history_table no_history_system_period invalid_types invalid_system_period_values versioning versioning_custom_system_time structure uninstall 2>&1 | Out-Default

if ($LASTEXITCODE -ne 0) {
Get-Content -Path ".\regression.diffs" | Out-Printer
if (Test-Path -Path ".\regression.diffs") {
Get-Content -Path ".\regression.diffs" | Out-Host
}
Write-Error "Tests failed"
}
env:
Expand Down