Skip to content

Commit

Permalink
Upgrade for Postgres 16
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
theory committed Aug 14, 2023
1 parent fbf3ccc commit e0d6311
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -31,19 +31,19 @@ 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
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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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')
```

Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions bin/pgxn-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions test/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -eu

pgversion=$1
export GITHUB_OUTPUT="/tmp/github_output"

cd $(dirname "$0")
pg-start $pgversion
Expand All @@ -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
Binary file removed test/widget-1.0.0.zip
Binary file not shown.

0 comments on commit e0d6311

Please sign in to comment.