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
51 changes: 47 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@ on:
branches:
- main
workflow_dispatch:
inputs:
pg_client_version:
description: 'pg_client extension version fetched from extension.ladybugdb.com (default: 0.19.0)'
required: false
default: '0.19.0'
env:
# Version of the pg_client extension fetched from
# https://extension.ladybugdb.com/<ver>/linux_amd64/pg_client/...
# Overridable via the workflow_dispatch `pg_client_version` input.
PG_CLIENT_VERSION: ${{ inputs.pg_client_version || '0.19.0' }}
jobs:
test:
# Per-version gate on real PostgreSQL servers via the official PGXN
# toolchain: pg-build-test compiles, installs, and regress-tests the
# extension against the started PG, then test.sh runs the full
# functional suite (pgembed builds against its bundled PostgreSQL, which
# uses its own Unix socket dir and never conflicts with pg-start).
strategy:
matrix:
pg: [16, 17, 18]
Expand All @@ -24,8 +39,36 @@ jobs:
run: |
mkdir -p lib
LBUG_TARGET_DIR=$PWD/lib LBUG_LIB_KIND=shared bash scripts/download-liblbug.sh
# TODO: download libpg_client.lbug_extension alongside liblbug.so
# so the bridge can LOAD the pg_client extension for ATTACH.
# See: ladybug_bridge_attach_postgres() in ladybug_bridge.c
- name: Test on PostgreSQL ${{ matrix.pg }}
- name: Download pg_client extension (for ATTACH)
run: |
# Placed next to liblbug.so so ladybug_bridge_attach_postgres()
# can LOAD it when ATTACHing this Postgres to the Ladybug catalog.
curl -fSL "https://extension.ladybugdb.com/v${PG_CLIENT_VERSION}/linux_amd64/pg_client/libpg_client.lbug_extension" -o lib/libpg_client.lbug_extension
- name: Build and install on PostgreSQL ${{ matrix.pg }} (PGXN)
run: pg-build-test
- name: Set up uv (for pgembed + psycopg)
uses: astral-sh/setup-uv@v9.0.0
- name: Functional tests via pgembed on PostgreSQL ${{ matrix.pg }}
run: ./scripts/test.sh
pgembed:
# Fast functional signal on a plain runner (no container): the full
# ./scripts/test.sh suite. pgembed pins its own bundled PostgreSQL, so
# this single PG-18 leg stands in for the matrix's functional runs.
name: 🔬 PostgreSQL 18 (pgembed functional)
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up uv (for pgembed + psycopg)
uses: astral-sh/setup-uv@v9.0.0
- name: Download liblbug (for Cypher planner)
run: |
mkdir -p lib
LBUG_TARGET_DIR=$PWD/lib LBUG_LIB_KIND=shared bash scripts/download-liblbug.sh
- name: Download pg_client extension (for ATTACH)
run: |
# Placed next to liblbug.so so ladybug_bridge_attach_postgres()
# can LOAD it when ATTACHing this Postgres to the Ladybug catalog.
curl -fSL "https://extension.ladybugdb.com/v${PG_CLIENT_VERSION}/linux_amd64/pg_client/libpg_client.lbug_extension" -o lib/libpg_client.lbug_extension
- name: Run functional test suite
run: ./scripts/test.sh
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MODULE_big = pg_ladybug
EXTENSION = pg_ladybug
DATA = pg_ladybug--1.0.sql
OBJS = $(WIN32RES) pg_ladybug.o ladybug_bridge.o
OBJS = $(WIN32RES) pg_ladybug.o ladybug_bridge.o ladybug_bridge_guard.o
PG_CPPFLAGS = -I.
# Search the vendored lib/ *before* any system liblbug (PG_LDFLAGS is
# prepended to LDFLAGS by PGXS, so it wins over -L paths baked into pg_config,
Expand All @@ -16,6 +16,16 @@ PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

# Link the C++ runtime: ladybug_bridge_guard.o is C++ (compiled with $(CXX))
# and PGXS links the shared library with the C driver ($(CC)), so the C++
# runtime must be pulled in explicitly. Without it the link fails with
# undefined symbols for std::exception / __cxa_throw.
ifeq ($(PORTNAME), darwin)
SHLIB_LINK += -lc++
else
SHLIB_LINK += -lstdc++
endif

# Convenience test targets (local postgres, requires liblbug.so)
# -------------------------------------------------------------------
# Quick test: build, install, run test.sql against the default cluster
Expand Down
Loading
Loading