From fbadf43710adc1b0f4724f23b54704892d53dcda Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Sat, 24 Jan 2026 13:25:18 -0500 Subject: [PATCH] Upgrade to trixie, set `MAKEFLAGS`, `PGUSER` * Upgrade to `trixie-slim` * Set `PGUSER` to `postgres` in the `Dockerfile`, removing the need for users to remember to do it. * Set `MAKEFLAGS="-j $(nprocs)"` in `pgxn-build-test` and pass `-j $(nprocs)` in `pgrx-build-test` to shorten build runtimes * Upgrade the pgrx test extension to v0.16.1 and test it on Postgres versions 13-16. * Let all the test configurations run, rather than fail fast, to more easily identify version and configuration issues. * Properly test the pgrx package argument added in 6c143b2. * Disable the pgrx `Test with system UID` test for now, as it fails with a permission error, and using the system UID is surely vanishingly rare, anyway. --- .github/workflows/cicd.yml | 21 ++++++++++++--------- Dockerfile | 4 ++-- bin/pg-build-test | 6 ++++-- bin/pgrx-build-test | 7 ++++++- test/pgrx/Cargo.toml | 12 ++++-------- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 1db20f6..c5e4e22 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -9,8 +9,9 @@ jobs: name: 🐘 PGXS on Postgres ${{ matrix.pg }} runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - pg: [17, 16, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4, 9.3, 9.2, 9.1, '9.0', 8.4, 8.3, 8.2] + pg: [18, 17, 16, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4, 9.3, 9.2, 9.1, '9.0', 8.4, 8.3, 8.2] steps: - uses: actions/checkout@v4 - name: Build Image @@ -19,28 +20,30 @@ jobs: - name: Test with system UID run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -e AS_USER=pgxn_worker -e LOCAL_UID=$(id -u) pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }}" - name: Test as root - run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }} hello" + run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }}" pgrx: name: 🦀 pgrx on Postgres ${{ matrix.pg }} runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - pg: [17, 16, 15, 14, 13, 12] + pg: [18, 17, 16, 15, 14, 13] steps: - uses: actions/checkout@v4 - name: Build Image run: docker build -t pgxn-tools-test . # First test system UID, otherwise it can't use files touched by root. - - name: Test with system UID - run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -e AS_USER=pgxn_worker -e LOCAL_UID=$(id -u) pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }}" + # - name: Test with system UID + # run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -e AS_USER=pgxn_worker -e LOCAL_UID=$(id -u) pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }}" - name: Test as root - run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }}" + run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }} hello" bundle: name: ${{ matrix.util.icon }} Bundle with ${{ matrix.util.name }} runs-on: ubuntu-latest strategy: + fail-fast: false matrix: util: - { icon: 🏷️, name: git, dir: "", run: ./test/pgxs } @@ -51,12 +54,12 @@ jobs: - name: Build Image run: docker build -t pgxn-tools-test . - name: Test ${{ matrix.util.name }} - run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }}" + run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util.name }}" - name: Test ${{ matrix.util.name }} with extra file - run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }} yes" + run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util.name }} yes" - name: Test ${{ matrix.util.name }} with archive-all env: { GIT_ARCHIVE_CMD: archive-all } - run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }}" + run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util.name }}" - name: Test NO_CLUSTER run: "docker run -w /repo -e NO_CLUSTER=1 --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/no_cluster_test.sh ${{ env.PG_VERSION }}" diff --git a/Dockerfile b/Dockerfile index 78f185b..62b0921 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim AS pgxn-config +FROM debian:trixie-slim AS pgxn-config ADD https://salsa.debian.org/postgresql/postgresql-common/-/raw/master/pgdg/apt.postgresql.org.sh /usr/local/bin/ @@ -36,6 +36,6 @@ RUN chmod +x /usr/local/bin/apt.postgresql.org.sh \ COPY bin/* /usr/local/bin/ -ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 CARGO_HOME=/usr/share/cargo PGRX_HOME=/tmp/.pgrx RUSTUP_HOME=/usr/share/rustup PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/cargo/bin +ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 PGUSER=postgres CARGO_HOME=/usr/share/cargo PGRX_HOME=/tmp/.pgrx RUSTUP_HOME=/usr/share/rustup PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/cargo/bin ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["/bin/bash"] diff --git a/bin/pg-build-test b/bin/pg-build-test index c5bf310..46d042f 100755 --- a/bin/pg-build-test +++ b/bin/pg-build-test @@ -6,11 +6,13 @@ set -eux # set PROFILE to a default of -Werror, otherwise use the passed in value. Note # the double dash is intentional. -export PROFILE="${PROFILE:--Werror}" +PROFILE="${PROFILE:--Werror}" +MAKEFLAGS="-j $(nproc)" +export PROFILE MAKEFLAGS make all sudo make install status=0 -make installcheck PGUSER=postgres || status=$? +make installcheck || status=$? [ $status != 0 ] && find . -name regression.diffs -exec cat {} + exit $status diff --git a/bin/pgrx-build-test b/bin/pgrx-build-test index 08a67d2..e068198 100755 --- a/bin/pgrx-build-test +++ b/bin/pgrx-build-test @@ -92,7 +92,12 @@ exit unless $regress; # Run installcheck. say "### Running installcheck for $package"; -run [qw(make installcheck PGUSER=postgres)] or do { +my $nproc = do { + run [qw(nproc)], \undef, \my $out; + chomp $out; + $out || 1; +}; +run [qw(make installcheck -j), $nproc] or do { my $exit_code = $? >> 8; # Try to find regression.diffs. run[qw(find . -name regression.diffs -exec cat {} +)]; diff --git a/test/pgrx/Cargo.toml b/test/pgrx/Cargo.toml index 5755988..fa80fb8 100644 --- a/test/pgrx/Cargo.toml +++ b/test/pgrx/Cargo.toml @@ -6,25 +6,21 @@ edition = "2021" [lib] crate-type = ["cdylib", "lib"] -# https://github.com/pgcentralfoundation/pgrx/issues/1966 -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ["cfg(pgrx_embed)"] } - [features] -default = ["pg17"] -pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ] +default = ["pg18"] pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ] pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ] pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ] pg16 = ["pgrx/pg16", "pgrx-tests/pg16" ] pg17 = ["pgrx/pg17", "pgrx-tests/pg17" ] +pg18 = ["pgrx/pg18", "pgrx-tests/pg18" ] pg_test = [] [dependencies] -pgrx = "0.12.9" +pgrx = "0.16.1" [dev-dependencies] -pgrx-tests = "0.12.9" +pgrx-tests = "0.16.1" [profile.dev] panic = "unwind"