Skip to content

Fix ubuntu ci and start testing PG18 #2893

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

Merged
merged 2 commits into from
May 22, 2025
Merged
Changes from all commits
Commits
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
29 changes: 15 additions & 14 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ jobs:
strategy:
fail-fast: false
matrix:
psql: [13,14,15,16,17]
psql: [13, 14, 15, 16, 17, 18]
postgis: [3]
os: [ubuntu-latest, ubuntu-22.04, ubuntu-20.04]
os: [ubuntu-latest, ubuntu-22.04]

steps:
- uses: actions/checkout@v4

- name: get postgres version
- name: 'Raise Priority for apt.postgresql.org'
run: |
sudo service postgresql start
pgver=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
echo "PGVER=${pgver}" >> $GITHUB_ENV
PGP=5433
if [ "${{ matrix.psql }}" == "${pgver}" ]; then PGP=5432; fi
echo "PGPORT=${PGP}" >> $GITHUB_ENV

cat << EOF >> ./pgdg.pref
Package: *
Pin: release o=apt.postgresql.org
Pin-Priority: 600
EOF
sudo mv ./pgdg.pref /etc/apt/preferences.d/
sudo apt update

- name: Add PostgreSQL APT repository
run: |
sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get purge postgresql-*
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg-testing main ${{ matrix.psql }}" > /etc/apt/sources.list.d/pgdg.list'
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null

- name: Install dependencies
run: |
Expand Down Expand Up @@ -81,6 +81,7 @@ jobs:
run: |
sudo service postgresql start
export PG_RUNNER_USER=`whoami`
export PGPORT=5432
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Explicit PostgreSQL port binding.
Setting PGPORT=5432 makes connections predictable. For consistency, consider adding -p ${PGPORT} to all psql invocations so every command targets the same port explicitly.

🤖 Prompt for AI Agents
In .github/workflows/ubuntu.yml at line 84, the environment variable PGPORT is
set to 5432, but psql commands do not explicitly specify the port. To ensure all
psql commands connect to the intended port consistently, update every psql
invocation in the workflow to include the option -p ${PGPORT}, explicitly
binding them to port 5432.

sudo -u postgres psql -p ${PGPORT} -c "DROP DATABASE IF EXISTS ___pgr___test___;"
sudo -u postgres psql -p ${PGPORT} -c "DROP DATABASE IF EXISTS \"${PG_RUNNER_USER}\";"
sudo -u postgres psql -p ${PGPORT} -c "DROP ROLE IF EXISTS \"${PG_RUNNER_USER}\";"
Expand Down