From 35fb903c0f3c99fdf4d8fcbf44a9dc55beabb7dd Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sun, 13 Aug 2023 17:06:28 -0400 Subject: [PATCH] Add Test for PG16 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 --- .github/scripts/postgresql_postgis.sh | 31 ++++++++++++++++--- .../workflows/jammy_postgres16_postgis3.yml | 28 +++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/jammy_postgres16_postgis3.yml diff --git a/.github/scripts/postgresql_postgis.sh b/.github/scripts/postgresql_postgis.sh index 806aa0d..6bf60a7 100755 --- a/.github/scripts/postgresql_postgis.sh +++ b/.github/scripts/postgresql_postgis.sh @@ -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 diff --git a/.github/workflows/jammy_postgres16_postgis3.yml b/.github/workflows/jammy_postgres16_postgis3.yml new file mode 100644 index 0000000..19a1ad9 --- /dev/null +++ b/.github/workflows/jammy_postgres16_postgis3.yml @@ -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