Skip to content

Commit

Permalink
Add Test for PG16
Browse files Browse the repository at this point in the history
Note other changes needed to be made for this:

 - Add new postgres16, it's misnamed as moment, cause it doesn't have
   postgis yet
    - Change postgresql_postgis.sh to:

       - Use trusted instead of apt-key which is deprecated
       - Added a condition to postgresql_postgis.sh to skip PostGIS
	 install if no PostGIS version is specified
         Since PostGIS is not yet available in
	 apt.postgresql.org repo for PG16
       - Use pgdg-snapshot instead of main
	 repo except for PG12
	 (it has all stable branches and main)
       - For PG12, jsut continue to use main repo,
         since PostGIS 2.5 is not carried in snapshot
  • Loading branch information
robe2 committed Aug 13, 2023
1 parent 553a137 commit 35fb903
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
31 changes: 27 additions & 4 deletions .github/scripts/postgresql_postgis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@

set -e

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main $POSTGRESQL_VERSION" |sudo tee /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

if ["$POSTGRESQL_VERSION" = "12"];
then
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main $POSTGRESQL_VERSION" |sudo tee /etc/apt/sources.list.d/pgdg.list
else
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg-snapshot main $POSTGRESQL_VERSION" |sudo tee /etc/apt/sources.list.d/pgdg.list
fi

# RAISE priority of pgdg
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
sudo apt-get update
sudo apt-get --purge remove postgresql\*
sudo apt-get install -q postgresql-server-dev-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION libcunit1-dev valgrind g++
sudo apt-get purge postgresql-*
sudo apt-get install -q postgresql-$POSTGRESQL_VERSION postgresql-server-dev-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION libcunit1-dev valgrind g++

if [ -z "$POSTGIS_VERSION" ]
then
echo "No PostGIS version specified, skipping install of PostGIS"
else
sudo apt-get install postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION
fi

sudo pg_dropcluster --stop $POSTGRESQL_VERSION main
sudo rm -rf /etc/postgresql/$POSTGRESQL_VERSION /var/lib/postgresql/$POSTGRESQL_VERSION
sudo pg_createcluster -u postgres $POSTGRESQL_VERSION main --start -- --auth-local trust --auth-host trust
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/jammy_postgres16_postgis3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "[ubuntu-22.04] PostgreSQL 16 and PostGIS 3"

on:
push:
branches:
- master

pull_request:

jobs:
build:
name: Building and testing
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install PostgreSQL and PostGIS
env:
POSTGRESQL_VERSION: 16
#POSTGIS_VERSION: 3
run: .github/scripts/postgresql_postgis.sh
- name: Install and check PgPointCloud
run: .github/scripts/pgpointcloud.sh
- name: Error
if: ${{ failure() }}
run: cat pgsql/regression.diffs
- name: Dump and restore tests
run: .github/scripts/test_dump_restore.sh

0 comments on commit 35fb903

Please sign in to comment.