From ccda1998203d6d849d4e9979af31e78c3c2e9810 Mon Sep 17 00:00:00 2001 From: vados Date: Fri, 8 Dec 2023 13:08:44 +0900 Subject: [PATCH] feat(pgrx): support pg16 This commit updates pgrx to 0.11.2 and adds support for Postgres 16 (https://www.postgresql.org/docs/16/). Signed-off-by: vados --- .github/workflows/build-rpm/action.yaml | 2 +- .github/workflows/test.yaml | 4 ++++ Cargo.toml | 12 +++++++++++- Justfile | 12 ++++++------ README.md | 12 ++++++------ 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-rpm/action.yaml b/.github/workflows/build-rpm/action.yaml index 66ad2f2..70a1488 100644 --- a/.github/workflows/build-rpm/action.yaml +++ b/.github/workflows/build-rpm/action.yaml @@ -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: {} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e057730..96fb65b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,6 +15,10 @@ jobs: arch: x86_64 pgrx: version: pg15 + - rpm: + arch: x86_64 + pgrx: + version: pg16 steps: - uses: actions/checkout@v3 diff --git a/Cargo.toml b/Cargo.toml index 48ac246..ad70880 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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] @@ -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" diff --git a/Justfile b/Justfile index 1672b3a..76ab3de 100644 --- a/Justfile +++ b/Justfile @@ -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" @@ -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}} @@ -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 @@ -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") diff --git a/README.md b/README.md index 408931b..40b6f69 100644 --- a/README.md +++ b/README.md @@ -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] @@ -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 │   └── │   └── .pgrx @@ -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`: @@ -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 ```