Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install postgres-16 in CI #10687

Merged
merged 32 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dda6714
install postgres-16 on linux + macos
MichelleArk Sep 10, 2024
e79e981
start postgresql@16
MichelleArk Sep 10, 2024
b4d25fd
debugging postgres services
MichelleArk Sep 10, 2024
06a3a4a
put back install postgresql postgresql-contrib
MichelleArk Sep 10, 2024
6d4b50a
try removing postgres@14 before installing 16
MichelleArk Sep 10, 2024
db675a9
get postgres version from select
MichelleArk Sep 10, 2024
7bc9a22
remove psql --version check
MichelleArk Sep 10, 2024
508b45b
choco install postgres16 on windows
MichelleArk Sep 10, 2024
f5878a5
one liner
MichelleArk Sep 10, 2024
2ae2f96
pwsh set env variable
MichelleArk Sep 10, 2024
6fb14cf
invoke expression
MichelleArk Sep 10, 2024
cd9123f
try storing expression result in Out-String
MichelleArk Sep 10, 2024
6a2ff56
bash
MichelleArk Sep 10, 2024
75bbc4b
separate bash step
MichelleArk Sep 10, 2024
346a72c
more bash
MichelleArk Sep 10, 2024
611a8e5
get-service postgres 16
MichelleArk Sep 10, 2024
25a7c41
don't set PG_BINDIR and PG_LIBDIR
MichelleArk Sep 10, 2024
ad7c099
choco upgrade
MichelleArk Sep 10, 2024
75acd4e
choco install + set pg env vars manually
MichelleArk Sep 10, 2024
6cceaef
choco install + set pg env vars manually
MichelleArk Sep 10, 2024
7cd0194
export env vars
MichelleArk Sep 10, 2024
6393007
set PG_LIBDIR
MichelleArk Sep 10, 2024
2df4072
register postgresql16?
MichelleArk Sep 10, 2024
b6fc95b
register postgresql16?
MichelleArk Sep 10, 2024
d64ad99
typo
MichelleArk Sep 10, 2024
4c24b1b
typo
MichelleArk Sep 10, 2024
da7cd37
ProgramData
MichelleArk Sep 11, 2024
b6f0240
try upgrade again
MichelleArk Sep 11, 2024
d9aaae0
pg_ctl restart
MichelleArk Sep 11, 2024
2cfaa2a
windows debugging
MichelleArk Sep 11, 2024
bf25858
download directly
MichelleArk Sep 11, 2024
c8ad9ce
remove choco
MichelleArk Sep 11, 2024
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
11 changes: 10 additions & 1 deletion .github/actions/setup-postgres-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/actions/setup-postgres-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
18 changes: 16 additions & 2 deletions .github/actions/setup-postgres-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions test/setup_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
Expand Down