forked from repo-mirrors/dbt-core
install postgres-16 in CI (#10687)
This commit is contained in:
11
.github/actions/setup-postgres-linux/action.yml
vendored
11
.github/actions/setup-postgres-linux/action.yml
vendored
@@ -5,6 +5,15 @@ runs:
|
||||
steps:
|
||||
- shell: bash
|
||||
run: |
|
||||
sudo systemctl start postgresql.service
|
||||
sudo apt-get --purge remove postgresql postgresql-*
|
||||
sudo apt update -y
|
||||
sudo apt install gnupg2 wget vim -y
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
sudo apt update -y
|
||||
sudo apt install postgresql-16
|
||||
sudo apt-get -y install postgresql postgresql-contrib
|
||||
sudo systemctl start postgresql
|
||||
sudo systemctl enable postgresql
|
||||
pg_isready
|
||||
sudo -u postgres bash ${{ github.action_path }}/setup_db.sh
|
||||
|
||||
@@ -5,7 +5,8 @@ runs:
|
||||
steps:
|
||||
- shell: bash
|
||||
run: |
|
||||
brew services start postgresql
|
||||
brew install postgresql@16
|
||||
brew services start postgresql@16
|
||||
echo "Check PostgreSQL service is running"
|
||||
i=10
|
||||
COMMAND='pg_isready'
|
||||
|
||||
@@ -5,8 +5,22 @@ runs:
|
||||
steps:
|
||||
- shell: pwsh
|
||||
run: |
|
||||
$pgService = Get-Service -Name postgresql*
|
||||
Write-Host -Object "Installing PostgreSQL 16 as windows service..."
|
||||
$installerArgs = @("--install_runtimes 0", "--superpassword root", "--enable_acledit 1", "--unattendedmodeui none", "--mode unattended")
|
||||
$filePath = Invoke-DownloadWithRetry -Url "https://get.enterprisedb.com/postgresql/postgresql-16.1-1-windows-x64.exe" -Path "$env:PGROOT/postgresql-16.1-1-windows-x64.exe"
|
||||
Start-Process -FilePath $filePath -ArgumentList $installerArgs -Wait -PassThru
|
||||
|
||||
Write-Host -Object "Validating PostgreSQL 16 Install..."
|
||||
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
|
||||
}
|
||||
|
||||
Write-Host -Object "Starting PostgreSQL 16 Service..."
|
||||
$pgService = Get-Service -Name postgresql-x64-16
|
||||
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
|
||||
|
||||
@@ -39,6 +39,7 @@ for i in {1..10}; do
|
||||
done;
|
||||
|
||||
createdb dbt
|
||||
psql -c "SELECT version();"
|
||||
psql -c "CREATE ROLE root WITH PASSWORD 'password';"
|
||||
psql -c "ALTER ROLE root WITH LOGIN;"
|
||||
psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;"
|
||||
|
||||
Reference in New Issue
Block a user