Skip to content

Commit

Permalink
feat(pgrx): support pg16
Browse files Browse the repository at this point in the history
This commit updates pgrx to 0.11.2 and adds support for Postgres
16 (https://www.postgresql.org/docs/16/).

Signed-off-by: vados <[email protected]>
  • Loading branch information
t3hmrman committed Dec 11, 2023
1 parent ab914ce commit ccda199
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-rpm/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inputs:
Architecture to use while building the RPM
pgrx-version:
type: string
default: pg15
default: pg16
decription: |
PGRX version (ex. 'pg15', 'pg16')
outputs: {}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
arch: x86_64
pgrx:
version: pg15
- rpm:
arch: x86_64
pgrx:
version: pg16
steps:
- uses: actions/checkout@v3

Expand Down
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ crate-type = ["cdylib"]
maintenance = { status = "actively-maintained" }

[features]
default = ["pg15"]
default = ["pg16"]
pg11 = ["pgrx/pg11", "pgrx-tests/pg11"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12"]
pg13 = ["pgrx/pg13", "pgrx-tests/pg13"]
pg14 = ["pgrx/pg14", "pgrx-tests/pg14"]
pg15 = ["pgrx/pg15", "pgrx-tests/pg15"]
pg16 = ["pgrx/pg16", "pgrx-tests/pg16"]
pg_test = []

[dependencies]
Expand Down Expand Up @@ -105,3 +106,12 @@ assets = [
]
requires = { postgresql-server = "> 15", glibc = "*" }
release = "pg15"

[package.metadata.generate-rpm.variants.pg16]
assets = [
{ source = "/tmp/pg_idkit/rpm/scratch/pgrx-install/lib/postgresql/pg_idkit.so", dest = "/usr/lib64/pgsql/pg_idkit.so", mode = "755" },
{ source = "/tmp/pg_idkit/rpm/scratch/pgrx-install/share/postgresql/extension/pg_idkit--0.1.0.sql", dest = "/usr/share/pgsql/extension/pg_idkit--0.1.0.sql", mode = "755" },
{ source = "/tmp/pg_idkit/rpm/scratch/pgrx-install/share/postgresql/extension/pg_idkit.control", dest = "/usr/share/pgsql/extension/pg_idkit.control", mode = "755" },
]
requires = { postgresql-server = "> 15", glibc = "*" }
release = "pg16"
12 changes: 6 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ cargo_features_arg := if cargo_features != "" {

changelog_file_path := absolute_path(justfile_directory() / "CHANGELOG")

pkg_pg_version := env_var_or_default("PKG_PG_VERSION", "15.5")
pkg_pg_version := env_var_or_default("PKG_PG_VERSION", "16.1")
pkg_pg_config_path := env_var_or_default("PKG_PG_CONFIG_PATH", "~/.pgrx/" + pkg_pg_version + "/pgrx-install/bin/pg_config")

pgrx_pg_version := env_var_or_default("PGRX_PG_VERSION", "pg15")
pgrx_pg_version := env_var_or_default("PGRX_PG_VERSION", "pg16")
pgrx_pkg_path_prefix := env_var_or_default("PGRX_PKG_PATH_PREFIX", "target")
pgrx_pkg_output_dir := pgrx_pkg_path_prefix / "release" / "pg_idkit-" + pgrx_pg_version / "home" / user / ".pgrx" / pkg_pg_version / "pgrx-install"

Expand Down Expand Up @@ -82,6 +82,9 @@ print-revision:
#!/usr/bin/env -S bash -euo pipefail
echo -n `{{just}} get-revision`

print-pkg-output-dir:
echo -n {{pgrx_pkg_output_dir}}

changelog:
{{git}} cliff --unreleased --tag={{version}} --prepend={{changelog_file_path}}

Expand Down Expand Up @@ -110,9 +113,6 @@ package:
cp -r $({{just}} print-pkg-output-dir)/* pkg/pg_idkit-$({{just}} print-version)
{{tar}} -C pkg -cvf pg_idkit-$(just print-version).tar.gz pg_idkit-$({{just}} print-version)

print-pkg-output-dir:
echo -n {{pgrx_pkg_output_dir}}

test:
{{cargo}} test {{cargo_profile_arg}}
{{cargo}} pgrx test
Expand All @@ -123,7 +123,7 @@ test:

container_img_arch := env_var_or_default("CONTAINER_IMAGE_ARCH", "amd64")

pg_image_version := env_var_or_default("POSTGRES_IMAGE_VERSION", "15.5")
pg_image_version := env_var_or_default("POSTGRES_IMAGE_VERSION", "16.1")
pg_os_image_version := env_var_or_default("POSTGRES_OS_IMAGE_VERSION", "alpine3.18")

pgidkit_image_name := env_var_or_default("PGIDKIT_IMAGE_NAME", "ghcr.io/vadosware/pg_idkit")
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ docker run \
-e POSTGRES_PASSWORD=replace_this \
-p 5432 \
--name pg_idkit \
ghcr.io/vadosware/pg_idkit:0.1.0-pg15.5-alpine3.18-amd64
ghcr.io/vadosware/pg_idkit:0.1.0-pg16.1-alpine3.18-amd64
```

> [!WARNING]
Expand Down Expand Up @@ -103,10 +103,10 @@ cargo install cargo-get cargo-pgrx just
just package
```

After running these commands you should see the following directory structure in `target/release/pg_idkit-pg15`:
After running these commands you should see the following directory structure in `target/release/pg_idkit-pg16`:

```
target/release/pg_idkit-pg15
target/release/pg_idkit-pg16
├── home
│   └── <user>
│   └── .pgrx
Expand Down Expand Up @@ -184,7 +184,7 @@ docker run \
-e POSTGRES_PASSWORD=replace_this \
-p 5432 \
--name pg_idkit \
ghcr.io/vadosware/pg_idkit:0.1.0-pg15.5-alpine3.18-amd64
ghcr.io/vadosware/pg_idkit:0.1.0-pg16.1-alpine3.18-amd64
```

From another terminal, you can exec into the `pg_idkit` container and enable `pg_idkit`:
Expand Down Expand Up @@ -221,10 +221,10 @@ RPMs are produced upon [every official release](/releases) of `pg_idkit`.

Grab a released version of the RPM (or build one yourself by running `just build-rpm` after [setting up local development][guide-localdev]).

For example, with an RPM named `pg_idkit-0.1.0-pg15.x86_64.rpm`, you should be able to run:
For example, with an RPM named `pg_idkit-0.1.0-pg16.x86_64.rpm`, you should be able to run:

```
dnf install pg_idkit-0.1.0-pg15.x86_64.rpm
dnf install pg_idkit-0.1.0-pg16.x86_64.rpm
```

</details>
Expand Down

0 comments on commit ccda199

Please sign in to comment.