Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pgactive PG-Master CI
name: pgactive PG-Devel CI
on:
#schedule:
# # Runs every day at 5am.
Expand Down Expand Up @@ -35,59 +35,53 @@ jobs:

- name: Checkout Postgres
run: |
sudo apt-get -y -q install libipc-run-perl build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libicu-dev
sudo apt-get -y -q install libipc-run-perl build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libicu-dev meson ninja-build
git clone --depth 1 --branch ${{ matrix.version }} https://github.com/postgres/postgres.git

- if: ${{ matrix.version == 'REL_11_STABLE' }}
name: Apply per-test-script runtime display patch (REL_11_STABLE only)
run: |
cd postgres
git apply $GITHUB_WORKSPACE/pgactive/src/compat/11/v1-0001-Add-per-test-script-runtime-display-to-pg_regress.patch
git status

- name: Build Postgres
run: |
cd $GITHUB_WORKSPACE/postgres
sh configure --prefix=$PWD/inst/ --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb3 -O0"
make -j4 install

# Install extensions required for pgactive tests
make -C contrib/btree_gist install
make -C contrib/cube install
make -C contrib/hstore install
make -C contrib/pg_trgm install
# meson build. contrib (btree_gist, cube, hstore, pg_trgm) and the
# PostgreSQL::Test perl modules are built and installed as part of the
# main tree, so no separate contrib install steps are needed.
meson setup build --prefix=$PWD/inst --buildtype=debug -Dcassert=true -Dtap_tests=enabled
ninja -C build install

- name: Check pgactive code indentation
run: |
cd $GITHUB_WORKSPACE/pgactive
ls -1 src/compat/??/pg_dump/*.[ch] >$GITHUB_WORKSPACE/postgres/pgindent.ignore

cd $GITHUB_WORKSPACE/postgres
make -C src/tools/pg_bsd_indent/ -j4 install
src/tools/pgindent/pgindent --indent=$GITHUB_WORKSPACE/postgres/src/tools/pg_bsd_indent/pg_bsd_indent --excludes=pgindent.ignore --diff $GITHUB_WORKSPACE/pgactive > pgindent.diffs
# pg_bsd_indent is built by meson but not installed; use it from the build tree.
ninja -C build src/tools/pg_bsd_indent/pg_bsd_indent
src/tools/pgindent/pgindent --indent=$GITHUB_WORKSPACE/postgres/build/src/tools/pg_bsd_indent/pg_bsd_indent --excludes=pgindent.ignore --diff $GITHUB_WORKSPACE/pgactive > pgindent.diffs
test -s pgindent.diffs && cat pgindent.diffs && exit 1 || exit 0

- name: Build pgactive
run: |
cd pgactive
PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
sh configure
make PROFILE="-Wall -Wmissing-prototypes -Werror=maybe-uninitialized -Werror" -j1 all install
cd $GITHUB_WORKSPACE/pgactive
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
meson setup build -Dpg_config=$GITHUB_WORKSPACE/postgres/inst/bin/pg_config -Dwarning_level=1 -Dwerror=true
ninja -C build install

- name: Run pgactive core tests
run: |
cd pgactive
make regress_check
cd $GITHUB_WORKSPACE/pgactive
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
meson test -C build --suite regress --print-errorlogs

- name: Show pgactive core tests diff
if: ${{ failure() }}
run: |
cat pgactive/test/regression.diffs
cat pgactive/build/meson-logs/testlog.txt 2>/dev/null || true
cat pgactive/test/regression.diffs 2>/dev/null || true

- name: Run pgactive extended tests
run: |
cd pgactive
make PROVE_FLAGS="--timer -v" prove_check
cd $GITHUB_WORKSPACE/pgactive
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
meson test -C build --suite tap --print-errorlogs

- name: Upload test artifacts
if: ${{ failure() }}
Expand All @@ -96,6 +90,6 @@ jobs:
name: test-artifact-${{ matrix.os }}-${{ matrix.version }}
path: |
postgres/pgindent.diffs
pgactive/test/regression.diffs
pgactive/test/tmp_check/log
pgactive/build/meson-logs
pgactive/build/tmp_check/log
retention-days: 1
69 changes: 50 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ jobs:
- id: set-versions
run: |
curl -s https://www.postgresql.org/versions.json > versions.json
# Format as JSON array and map 'major' to 'REL_XX_STABLE' for postgres branch checkout
VERSIONS=$(jq -c '[.[] | select(.supported == true) | "REL_" + (.major | tostring) + "_STABLE"]' versions.json)
# Emit {branch, major} per supported release: branch for checkout,
# major (an integer) so the job can pick meson vs autoconf directly.
VERSIONS=$(jq -c '[.[] | select(.supported == true) | {branch: ("REL_" + (.major | tostring) + "_STABLE"), major: .major}]' versions.json)
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT

test:
Expand All @@ -35,10 +36,14 @@ jobs:
matrix:
os: [ubuntu-latest]
version: ${{ fromJson(needs.setup-matrix.outputs.versions) }}

runs-on: ${{ matrix.os }}
timeout-minutes: 120

# Build PG 18 and newer with meson; keep autoconf/make for older majors.
env:
USE_MESON: ${{ matrix.version.major >= 18 && '1' || '0' }}

steps:
- name: Checkout pgactive
uses: actions/checkout@v4
Expand All @@ -47,10 +52,10 @@ jobs:

- name: Checkout Postgres
run: |
sudo apt-get -y -q install libipc-run-perl build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libicu-dev
git clone --depth 1 --branch ${{ matrix.version }} https://github.com/postgres/postgres.git
sudo apt-get -y -q install libipc-run-perl build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libicu-dev meson ninja-build
git clone --depth 1 --branch ${{ matrix.version.branch }} https://github.com/postgres/postgres.git

- if: ${{ matrix.version == 'REL_11_STABLE' }}
- if: ${{ matrix.version.branch == 'REL_11_STABLE' }}
name: Apply per-test-script runtime display patch (REL_11_STABLE only)
run: |
cd postgres
Expand All @@ -60,42 +65,68 @@ jobs:
- name: Build Postgres
run: |
cd postgres
sh configure --prefix=$PWD/inst/ --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb3 -O0"
make -j4 install
# Install extensions required for pgactive tests
make -C contrib/btree_gist install
make -C contrib/cube install
make -C contrib/hstore install
make -C contrib/pg_trgm install
if [ "$USE_MESON" = "1" ]; then
# meson build. contrib and the PostgreSQL::Test perl modules are
# built and installed with the main tree — no separate steps needed.
meson setup build --prefix=$PWD/inst --buildtype=debug -Dcassert=true -Dtap_tests=enabled
ninja -C build install
else
sh configure --prefix=$PWD/inst/ --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb3 -O0"
make -j4 install
# Install extensions required for pgactive tests
make -C contrib/btree_gist install
make -C contrib/cube install
make -C contrib/hstore install
make -C contrib/pg_trgm install
fi

- name: Build pgactive
run: |
cd pgactive
PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH" sh configure
make PROFILE="-Wall -Wmissing-prototypes -Werror=maybe-uninitialized -Werror" -j1 all install
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
if [ "$USE_MESON" = "1" ]; then
meson setup build -Dpg_config=$GITHUB_WORKSPACE/postgres/inst/bin/pg_config -Dwarning_level=1 -Dwerror=true
ninja -C build install
else
sh configure
make PROFILE="-Wall -Wmissing-prototypes -Werror=maybe-uninitialized -Werror" -j1 all install
fi

- name: Run pgactive core tests
run: |
cd pgactive
make regress_check
if [ "$USE_MESON" = "1" ]; then
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
meson test -C build --suite regress --print-errorlogs
else
make regress_check
fi

- name: Show pgactive core tests diff
if: ${{ failure() }}
run: |
cat pgactive/test/regression.diffs
cat pgactive/build/meson-logs/testlog.txt 2>/dev/null || true
cat pgactive/test/regression.diffs 2>/dev/null || true

- name: Run pgactive extended tests
run: |
cd pgactive
make PROVE_FLAGS="--timer -v" prove_check
if [ "$USE_MESON" = "1" ]; then
export PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
meson test -C build --suite tap --print-errorlogs
else
make PROVE_FLAGS="--timer -v" prove_check
fi

- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-artifact-${{ matrix.os }}-${{ matrix.version }}
name: test-artifact-${{ matrix.os }}-${{ matrix.version.branch }}
path: |
postgres/pgindent.diffs
pgactive/test/regression.diffs
pgactive/test/tmp_check/log
pgactive/build/meson-logs
pgactive/build/tmp_check/log
retention-days: 1
42 changes: 24 additions & 18 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
project(
'pgactive',
'c',
version: '2.1.9',
version: run_command(
'sh', '-c',
'sed -n \'s/^#define[[:space:]]\\+pgactive_VERSION[[:space:]]\\+"\\([^"]*\\)".*/\\1/p\' include/pgactive_version.h.in',
Comment thread
sharmay marked this conversation as resolved.
check: true,
).stdout().strip(),
license: 'Apache-2.0',
meson_version: '>= 0.57.0',
meson_version: '>= 0.58.0',
Comment thread
sharmay marked this conversation as resolved.
default_options: [
'c_std=gnu99',
'warning_level=2',
],
)
Expand All @@ -22,6 +25,7 @@ pg_config = find_program(
pg_bindir = run_command(pg_config, '--bindir', check: true).stdout().strip()
pg_includedir = run_command(pg_config, '--includedir', check: true).stdout().strip()
pg_includedir_server = run_command(pg_config, '--includedir-server', check: true).stdout().strip()
pg_pkgincludedir = run_command(pg_config, '--pkgincludedir', check: true).stdout().strip()
pg_pkglibdir = run_command(pg_config, '--pkglibdir', check: true).stdout().strip()
pg_sharedir = run_command(pg_config, '--sharedir', check: true).stdout().strip()
pg_libdir = run_command(pg_config, '--libdir', check: true).stdout().strip()
Expand All @@ -37,26 +41,23 @@ pg_major = run_command('sh', '-c',
message('Building against PostgreSQL @0@'.format(pg_major))

pg_inc = include_directories(pg_includedir, pg_includedir_server)
pg_inc_internal = include_directories(pg_includedir / 'postgresql' / 'internal')
pg_inc_internal = include_directories(pg_pkgincludedir / 'internal')

# pgxs directory (for test perl modules and pg_regress)
pgxs_dir = run_command('dirname', pg_pgxs, check: true).stdout().strip()
pgxs_basedir = run_command('dirname', pgxs_dir, check: true).stdout().strip()

# libpq
libpq = dependency('libpq', required: false)
if not libpq.found()
libpq = declare_dependency(
include_directories: include_directories(
run_command(pg_config, '--includedir', check: true).stdout().strip(),
),
dependencies: [
meson.get_compiler('c').find_library('pq',
dirs: [pg_libdir],
),
],
)
endif
# libpq — must be the copy that belongs to THIS pg_config, not whatever a
# system pkg-config/cmake happens to find first. A generic dependency('libpq')
# would prefer a distro libpq (e.g. /usr/lib64 via libpq.pc) over the target
# server's, an ABI mismatch when building against a custom-prefix install.
# pg_config's --libdir/--includedir are authoritative, exactly as PGXS uses them.
libpq = declare_dependency(
include_directories: include_directories(pg_includedir),
dependencies: [
meson.get_compiler('c').find_library('pq', dirs: [pg_libdir]),
],
)

# pgfeutils (needed by pgactive_dump)
cc = meson.get_compiler('c')
Expand Down Expand Up @@ -174,6 +175,9 @@ pgactive_lib = shared_module(
name_prefix: '',
install: true,
install_dir: pg_pkglibdir,
# Resolve the same libpq at runtime that we linked from pg_config --libdir,
# not a system copy — matters for custom-prefix servers not in ldconfig.
install_rpath: pg_libdir,
)

# ---- pgactive_init_copy binary ----
Expand All @@ -187,6 +191,7 @@ pgactive_init_copy = executable(
dependencies: [libpq, libpgport, libpgcommon],
install: true,
install_dir: pg_bindir,
install_rpath: pg_libdir,
)

# ---- pgactive_dump binary ----
Expand Down Expand Up @@ -233,6 +238,7 @@ pgactive_dump = executable(
dependencies: [libpq, libpgfeutils, libpgport, libpgcommon, libssl, libz, liblz4, libzstd],
install: true,
install_dir: pg_bindir,
install_rpath: pg_libdir,
)

# ---- Extension data files ----
Expand Down
Loading