|
57 | 57 | $psql_opt = "--bindir" |
58 | 58 | } |
59 | 59 |
|
60 | | - if ("$pg_version" -eq "14") { |
61 | | - & "C:\Program Files\PostgreSQL\14\uninstall-postgresql.exe" --mode unattended 2>&1 | Out-Default |
62 | | - Remove-Item -Recurse -Force "C:\Program Files\PostgreSQL\14" |
| 60 | + # Uninstall existing PostgreSQL installation in windows-latest (windows-2025) runner |
| 61 | + # https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md#postgresql |
| 62 | + if ("$pg_version" -eq "17") { |
| 63 | + & "C:\Program Files\PostgreSQL\17\uninstall-postgresql.exe" --mode unattended 2>&1 | Out-Default |
| 64 | + Remove-Item -Recurse -Force "C:\Program Files\PostgreSQL\17" |
63 | 65 | } |
64 | 66 |
|
65 | 67 | "PG_VERSION=$pg_version" >> $env:GITHUB_ENV |
@@ -96,25 +98,39 @@ jobs: |
96 | 98 | run: | |
97 | 99 | $ErrorActionPreference = "Stop" |
98 | 100 |
|
99 | | - Stop-Service -Name "postgresql$env:X64-$env:PG_VERSION" |
| 101 | + $serviceName = "postgresql$env:X64-$env:PG_VERSION" |
| 102 | + $pgData = "C:\pgdata" |
| 103 | + $pgPort = "55432" |
| 104 | +
|
| 105 | + $env:PGPORT = $pgPort |
| 106 | + $env:PGHOST = "localhost" |
| 107 | + $env:Path = "$env:PG_ROOT\bin;$env:Path" |
| 108 | +
|
| 109 | + if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) { |
| 110 | + Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue |
| 111 | + & "$env:PG_ROOT\bin\pg_ctl.exe" unregister -N "$serviceName" 2>&1 | Out-Default |
| 112 | + Start-Sleep -Seconds 2 |
| 113 | + } |
| 114 | + Remove-Item -Recurse -Force "$pgData" -ErrorAction SilentlyContinue |
100 | 115 |
|
101 | 116 | Copy ".\$env:RELEASE_DIR\temporal_tables.dll" "$env:PG_ROOT\lib" |
102 | 117 | Copy ".\*.sql" "$env:PG_ROOT\share\extension" |
103 | 118 | Copy ".\*.control" "$env:PG_ROOT\share\extension" |
104 | 119 |
|
105 | 120 | Set-Content -path pg.pass -value $env:PGPASSWORD -encoding ascii |
106 | | - & "$env:PG_ROOT\bin\initdb.exe" -A md5 -U postgres --pwfile=pg.pass C:\pgdata 2>&1 | Out-Default |
107 | | - & "$env:PG_ROOT\bin\pg_ctl.exe" register -S demand -N "postgresql$env:X64-$env:PG_VERSION" -D c:\pgdata 2>&1 | Out-Default |
| 121 | + & "$env:PG_ROOT\bin\initdb.exe" -A md5 -U postgres --pwfile=pg.pass "$pgData" 2>&1 | Out-Default |
| 122 | + & "$env:PG_ROOT\bin\pg_ctl.exe" register -S demand -N "$serviceName" -D "$pgData" -o "-p $pgPort" 2>&1 | Out-Default |
108 | 123 |
|
109 | | - Start-Service -Name "postgresql$env:X64-$env:PG_VERSION" |
| 124 | + Start-Service -Name "$serviceName" |
110 | 125 |
|
111 | 126 | Get-ChildItem "$env:PG_REGRESS" |
112 | | - & "C:\Program Files\PostgreSQL\17\lib\pgxs\src\test\regress\pg_regress.exe" --help 2>&1 | Out-Default |
113 | 127 |
|
114 | 128 | & "$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 |
115 | 129 |
|
116 | 130 | if ($LASTEXITCODE -ne 0) { |
117 | | - Get-Content -Path ".\regression.diffs" | Out-Printer |
| 131 | + if (Test-Path -Path ".\regression.diffs") { |
| 132 | + Get-Content -Path ".\regression.diffs" | Out-Host |
| 133 | + } |
118 | 134 | Write-Error "Tests failed" |
119 | 135 | } |
120 | 136 | env: |
|
0 commit comments