Skip to content

testing with older version 16.4-1 #6

testing with older version 16.4-1

testing with older version 16.4-1 #6

name: Setup PostgreSQL on Multiple OS
on: [push]
jobs:
postgresql-setup:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download PostgreSQL Portable for macOS
if: matrix.os == 'macos-latest'
run: wget https://get.enterprisedb.com/postgresql/postgresql-16.4-1-osx-binaries.zip -O postgresql.zip
- name: Download PostgreSQL Portable for Ubuntu
if: matrix.os == 'ubuntu-latest'
run: wget https://get.enterprisedb.com/postgresql/postgresql-16.4-1-linux-x64-binaries.tar.gz -O postgresql.tar.gz
- name: Download PostgreSQL Portable for Windows
if: matrix.os == 'windows-latest'
run: |
Invoke-WebRequest -Uri https://get.enterprisedb.com/postgresql/postgresql-16.4-1-windows-x64-binaries.zip -OutFile postgresql.zip
shell: pwsh
- name: Unpack PostgreSQL archive on macOS or Windows
if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest'
run: |
unzip postgresql.zip -d .
mv ./pgsql ./postgresql
- name: Unpack PostgreSQL archive on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
tar -xzf postgresql.tar.gz -C .
mv ./pgsql ./postgresql
- name: Setup PostgreSQL environment variables
run: |
echo 'POSTGRESQL_HOME=./postgresql' >> $GITHUB_ENV
echo 'PATH=$POSTGRESQL_HOME/bin:$PATH' >> $GITHUB_ENV
source $GITHUB_ENV
shell: bash
- name: Initialize PostgreSQL data directory
run: |
./postgresql/bin/initdb -D ./postgresql_data
shell: bash
- name: Start PostgreSQL server
run: |
./postgresql/bin/pg_ctl -D ./postgresql_data -l logfile start
shell: bash
- name: Wait for PostgreSQL to start
run: |
for i in {30..0}; do
if ./postgresql/bin/pg_isready &>/dev/null; then
break
fi
echo 'Waiting for PostgreSQL to start...'
sleep 1
done
shell: bash
- name: Set up PostgreSQL user and database
run: |
./postgresql/bin/createdb "runner"
./postgresql/bin/psql -c "CREATE USER msnoise WITH PASSWORD 'msnoise';"
./postgresql/bin/psql -c "ALTER USER msnoise WITH SUPERUSER;"
shell: bash
- name: Verify PostgreSQL setup
run: |
./postgresql/bin/psql -c "\l"
shell: bash