Compare commits

...

9 Commits

Author SHA1 Message Date
Michelle Ark
d2219090ee Install-Binary 2024-09-10 18:47:44 -04:00
Michelle Ark
6393007bd8 set PG_LIBDIR 2024-09-10 18:26:46 -04:00
Michelle Ark
7cd01947e0 export env vars 2024-09-10 18:20:03 -04:00
Michelle Ark
6cceaefa23 choco install + set pg env vars manually 2024-09-10 18:14:07 -04:00
Michelle Ark
75acd4eca1 choco install + set pg env vars manually 2024-09-10 18:09:52 -04:00
Michelle Ark
ad7c099348 choco upgrade 2024-09-10 17:55:48 -04:00
Michelle Ark
25a7c4146e don't set PG_BINDIR and PG_LIBDIR 2024-09-10 17:52:14 -04:00
Michelle Ark
611a8e5327 get-service postgres 16 2024-09-10 17:48:09 -04:00
Michelle Ark
346a72c9f8 more bash 2024-09-10 17:39:51 -04:00

View File

@@ -3,14 +3,39 @@ description: "Set up postgres service on windows vm for dbt integration tests"
runs:
using: "composite"
steps:
- shell: bash
run: |
choco install postgresql16 --params "/Password:password" --ia "--enable-components server,commandlinetools --extract-only 1" --no-progress
PG_BINDIR=$("$PROGRAMFILES/PostgreSQL/16/bin/pg_config.exe" --bindir)
PG_LIBDIR=$("$PROGRAMFILES/PostgreSQL/16/bin/pg_config.exe" --libdir)
- shell: pwsh
run: |
# Download postgres16
$url = "https://get.enterprisedb.com/postgresql/postgresql-16.1-1-windows-x64.exe"
$checkAccess = [System.Net.WebRequest]::Create($url)
$response = $checkAccess.GetResponse()
$installerUrl = $response.ResponseUri.OriginalString
# Invoke Install-Binary function
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")
Install-Binary `
-Url $url `
-InstallArgs $installerArgs `
-ExpectedSignature (Get-ToolsetContent).postgresql.signature
# Get Path to pg_ctl.exe
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
# Parse output of command above to obtain pure path
$pgBin = Split-Path -Path $pgPath.split('"')[1]
$pgRoot = Split-Path -Path $pgPath.split('"')[5]
$pgData = Join-Path $pgRoot "data"
# Validate PostgreSQL installation
$pgReadyPath = Join-Path $pgBin "pg_isready.exe"
$pgReady = Start-Process -FilePath $pgReadyPath -Wait -PassThru
$exitCode = $pgReady.ExitCode
if ($exitCode -ne 0) {
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
exit $exitCode
}
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru