From e0d6311a0ffe48a331901a9bd1b9057212cf95a4 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 14 Aug 2023 16:38:09 -0400 Subject: [PATCH] Upgrade for Postgres 16 Test on Postgres 16, update and tweak the docs, update the copyright year, and eliminate the GitHub `set-output` warning. Also test that `pgxn-bundle` properly writes the bundle variable to `$GITHUB_OUTPUT`. --- .github/workflows/cicd.yml | 2 +- LICENSE | 2 +- README.md | 26 +++++++++++++------------- bin/pgxn-bundle | 6 +----- test/runtest.sh | 10 ++++++++++ test/widget-1.0.0.zip | Bin 3569 -> 0 bytes 6 files changed, 26 insertions(+), 20 deletions(-) delete mode 100644 test/widget-1.0.0.zip diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c6bf866..6ef4657 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - pg: [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: [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@v3 - name: Build Image diff --git a/LICENSE b/LICENSE index d28b333..74365c8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2021 The PGXN Maintainers. +Copyright (c) 2020-2023 The PGXN Maintainers. This module is free software; you can redistribute it and/or modify it under the [PostgreSQL License](https://www.opensource.org/licenses/postgresql). diff --git a/README.md b/README.md index 9924649..dceefba 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ PGXN Extension Build and Test Tools Docker Image [![Test & Release Status](https://github.com/pgxn/docker-pgxn-tools/workflows/CI/CD/badge.svg)](https://github.com/pgxn/docker-pgxn-tools/actions) ``` sh -docker run -it --rm --mount "type=bind,src=$(pwd),dst=/repo" pgxn/pgxn-tools \ - sh -c 'cd /repo && pg-start 12 && pg-build-test' +docker run -it --rm -w /repo --mount "type=bind,src=$(pwd),dst=/repo" pgxn/pgxn-tools \ + sh -c 'pg-start 12 && pg-build-test' ``` This project provides a simple Docker image to enable the automated testing of @@ -19,7 +19,7 @@ releases to PGXN. The image contains these utilities: * [`pgxn-bundle`]: Validates the PGXN META.json file and bundles up a release * [`pgxn-release`]: Release to PGXN -The image is based on the Debian Buster Slim image, and uses the +The image is based on the Debian Bookworm Slim image, and uses the [PostgreSQL Apt] repository to install PostgreSQL, supporting versions [back to 8.2], as well as the latest prerelease version. @@ -31,9 +31,9 @@ the `AS_USER` environment variable, and a user with that name will be created with `sudo` privileges (already used by `pg-start` and `pg-build-test`): ``` sh -docker run -it --rm -e AS_USER=worker \ +docker run -it --rm -w /repo -e AS_USER=worker \ --mount "type=bind,src=$(pwd),dst=/repo" pgxn/pgxn-tools \ - sh -c 'cd /repo && sudo pg-start 14 && pg-build-test' + sh -c 'sudo pg-start 14 && pg-build-test' ``` The created user will have the UID 1001 unless `LOCAL_UID` is passed, which can @@ -41,9 +41,9 @@ usefully be set to the local UID so that the user has permission to access files in a mounted directory: ``` sh -docker run -it --rm -e AS_USER=worker -e LOCAL_UID=$(id -u) \ +docker run -it --rm -w /repo -e AS_USER=worker -e LOCAL_UID=$(id -u) \ --mount "type=bind,src=$(pwd),dst=/repo" pgxn/pgxn-tools \ - sh -c 'cd /repo && sudo pg-start 14 && pg-build-test' + sh -c 'sudo pg-start 14 && pg-build-test' ``` If no `LOCAL_UID` is set but `GITHUB_EVENT_PATH` is set (as it is in GitHub @@ -69,7 +69,7 @@ jobs: test: strategy: matrix: - pg: [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: [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] name: 🐘 PostgreSQL ${{ matrix.pg }} runs-on: ubuntu-latest container: pgxn/pgxn-tools @@ -82,13 +82,13 @@ jobs: run: pg-build-test ``` -If you need to run the tests as an unprivileged user, pass the `AS_USER` variable -as a container option: +If you need to run the tests as an unprivileged user, pass the `AS_USER` +variable as a container option: ``` yaml container: image: pgxn/pgxn-tools - options: -e AS_USER=rando + options: -e AS_USER=randy ``` This example demonstrates automatic publishing of a release whenever a tag is @@ -170,7 +170,7 @@ psql --no-psqlrc -U postgres -Atqc 'SHOW config_file' For example, to load PL/Perl: -``` +``` sh echo "shared_preload_libraries = '$libdir/plperl'" >> $(psql --no-psqlrc -U postgres -Atqc 'SHOW config_file') ``` @@ -296,7 +296,7 @@ Author Copyright and License --------------------- -Copyright (c) 2020-2021 The PGXN Maintainers. Distributed under the +Copyright (c) 2020-2023 The PGXN Maintainers. Distributed under the [PostgreSQL License] (see [LICENSE]). [cli]: https://github.com/pgxn/pgxnclient diff --git a/bin/pgxn-bundle b/bin/pgxn-bundle index 66bb151..a50a6a6 100755 --- a/bin/pgxn-bundle +++ b/bin/pgxn-bundle @@ -28,8 +28,4 @@ else (cd /tmp && zip -r $release.zip $release) mv /tmp/$release.zip . fi -if [[ -n "${GITHUB_OUTPUT-}" ]]; then - echo "bundle=$release.zip" >> $GITHUB_OUTPUT -else - echo "::set-output name=bundle::$release.zip" -fi +echo "bundle=$release.zip" >> $GITHUB_OUTPUT diff --git a/test/runtest.sh b/test/runtest.sh index 9802084..4fd211d 100755 --- a/test/runtest.sh +++ b/test/runtest.sh @@ -3,6 +3,7 @@ set -eu pgversion=$1 +export GITHUB_OUTPUT="/tmp/github_output" cd $(dirname "$0") pg-start $pgversion @@ -17,3 +18,12 @@ if [ ! -e widget-1.0.0.zip ]; then fi rm widget-1.0.0.zip + +if ! grep -F "bundle=widget-1.0.0.zip" "$GITHUB_OUTPUT"; then + echo "ERROR: Output 'bundle' not appended to $GITHUB_OUTPUT" + echo File: + ls -lah "$GITHUB_OUTPUT" + echo Contents: + cat "$GITHUB_OUTPUT" + exit 2 +fi diff --git a/test/widget-1.0.0.zip b/test/widget-1.0.0.zip deleted file mode 100644 index a03eed7d54db6d08e017ee1bfa0dc9fa65d95b17..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3569 zcmWIWW@h1H00EViRl#5el;CBMVJOc`Nlz`&HPkcEGtdtW;bdU`?6WWtgi9;985mh! zFf%Z)7y&f|0F4m=(i~u85@u-kZeV0!h+tu05JNY{*EPgZFRM5|51)BcgMIri8wl+E z9v)%2-S44WtAIy=ql|-$g+j}mlxv1dwp}-V`7Z0~|8qW%ww&D7Ueqz^%=PMgyLsVW zD-X@K6|oMr*>Q|X^!33EttBa0LdV%%83$WlBQ_4Y91l$TB0t*%=-9Ey27_1>#ov-iE9kMOH}`y(h-`;b1{xA)D6~imX-e{XaEw%b7QQt~_)?>-;q7 zT@x3-i!sk$k|tAo=#-*((dPFW?;juOsxIBHFty4*Z^orLqV8YybYG;OzaIGVdwx92 z%ig+Lw^;}LDundA^7Q0(XSiPX%UyqE4(G!+7nWDuyuWJurBnM4r#x@q58%8xP2{{*iGQi@}5{cFypPfRk@{5>0 zN&kFhg7zW3^ymc^5B|h?H|V40o9c}c_Z9*@c>{>WF+5tDSCU#>qF0=O&x@(OhWt$i zA}!y)YtOsEBCGXaMPbR+ma7&bzZU3EbIJ&Ow0?Wmqepj3roS&b?Hac6^d80!A_13J z47QX@*?xbgz||17I3iPS?kf)AiR!O8JmjxP1pK*B9`2j7mFJ1G&*tu%ncf#xN+;%e zS~BE)XzH$L=D()P8kzIyg*t!5-DHC&42xHo*)BW2$!5Csk>LOS<~f>wH(Xo1|ySuWR}n9_*bK^1V{K^j=W5w;!*$%<1jZW>qikN!RVUc=&V5*2FuD zjXz1q_I)~;xj$xVdgnb>j{PiQyA@wG3eFR=YG8^sV_NiI{nf7cC2?~>!HYd33ZVxt zC^Zqxh1ku)h$^sIsTBpO$t9^N1Pw*h6v$ay8LI=~h7R2fjy()9Dn@V^0#g(T!6#mm zWF!MjpYlK~hc);>=7B?wKvL~K83M^N7q#`yJmf0-T3E{0*p-nHRg9i5jo)Pp7Yc~Wku&+=_3tBzw+m7 z(fev+JAX|~i&&SK2JfLW%&%V^%jfJ%w(XfL{LAr~ZB|!aczFA!A3knZzixlHNc0o$ z@(S+{S-I;kNz~WpJ-OfWDph$&`#m2gJ=NucRm=h2j7)OO*yD|tK?3M=5D;K^>jJt|*Fg-I>tLM%2dmj7B&c zIm60AjfOaT8ZM&|8J9RKP-{U%$h>W=2R1iRLZ%3*P9)B7)Cvb-_>#s#U}F`0x55a^8{*XiyXBZaGH%Mdx^6HwRA