From 1c8faf49e7675f82f66d029702c529e4b844bc4b Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Sun, 24 May 2026 07:00:04 +0800 Subject: [PATCH] Add support for devel versions in CI and test pg19 Many thanks to Christoph Berg for debugging and fixing the commands for the "devel" version of the package. Co-authored-by: Christoph Berg --- .github/workflows/tests.yml | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1727cd2..a65de3c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,8 @@ jobs: "15", "16", "17", - "18" + "18", + "19devel" ] os: ["ubuntu-22.04"] @@ -37,23 +38,41 @@ jobs: - name: Set up prerequisites and environment run: | + echo "*********** ENVIRONMENT ************" + if [[ "${{ matrix.postgres_major_version }}" == *"devel" ]]; then + pg_major=$( echo "${{ matrix.postgres_major_version }}" | grep -Eo "[0-9]+") + devel="yes" + else + pg_major="${{ matrix.postgres_major_version }}" + devel="no" + fi + + export PG_MAJOR_VERSION=${pg_major} + echo "PG_MAJOR_VERSION=$PG_MAJOR_VERSION" >> $GITHUB_ENV + echo "MAKEFLAGS=$MAKEFLAGS -j $(grep -c ^processor /proc/cpuinfo)" >> $GITHUB_ENV + echo "" + echo "************ CLEAN IMAGE ***********" sudo apt remove -y '^postgres.*' '^libpq.*' echo "" echo "********* REPOSITORY SET UP ********" sudo apt-get install -y wget gnupg + + if [[ "${devel}" == "yes" ]]; then + sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg-snapshot main ${PG_MAJOR_VERSION}" + fi sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + + # pin the pgdg repository with higher priority than the OS (500) + echo "Package: *" | sudo tee /etc/apt/preferences.d/pgdg.pref + echo "Pin: release o=apt.postgresql.org" | sudo tee -a /etc/apt/preferences.d/pgdg.pref + echo "Pin-Priority: 800" | sudo tee -a /etc/apt/preferences.d/pgdg.pref + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update -y -qq --fix-missing - echo "" - echo "*********** ENVIRONMENT ************" - export PG_MAJOR_VERSION=${{ matrix.postgres_major_version }} - echo "PG_MAJOR_VERSION=$PG_MAJOR_VERSION" >> $GITHUB_ENV - echo "MAKEFLAGS=$MAKEFLAGS -j $(grep -c ^processor /proc/cpuinfo)" >> $GITHUB_ENV echo "" - echo "******** INSTALL POSTGRES **********" sudo apt-get install -y \ postgresql-$PG_MAJOR_VERSION \