You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ci: run postgres fixtures on linux + macos, register postgres.ts in native compiler
the postgres fixtures shipped in #512 were @test-skip — ci never exercised
them, so any regression in lib/postgres.ts or pg-bridge.c would land
silently. this gates them behind a new `@test-requires-env: PG_TESTS_ENABLED`
annotation and wires up postgres in both ci jobs:
- linux: services: postgres:16 container, libpq-dev installed, PG_TESTS_ENABLED=1
- macos: brew install libpq postgresql@16, brew services start, provision postgres
user/password/chadtest db, PG_TESTS_ENABLED=1
also fixes a separate gap in #512: src/chad-native.ts never called
registerStdlib for postgres.ts, so .build/chad rejected
`import { Pool } from "chadscript/postgres"` with 'stdlib module not found'.
all my prior verification went through node dist/chad-node.js which reads
lib/*.ts from disk — the embedded-stdlib path was untested. fixed by adding
the registerStdlib call alongside the other lib/ modules.
new test-discovery annotation: `@test-requires-env: VAR` skips a fixture
unless the env var is set and non-empty. enables conditional integration
tests without a separate test runner. extra docs added to the annotation
header in test-discovery.ts.
pg-bridge.o now appears in the verify-vendor loop, the package release
artifact cp commands (linux + macos), and scripts/build-target-sdk.sh,
matching the pattern used by every other bridge.
verified locally: full `PG_TESTS_ENABLED=1 npm run verify` green against
podman postgres:16 — all 5 fixtures pass, stage 0/1/2 self-hosting clean.
* ci: pg_config-first libpq detection in build-vendor.sh
ubuntu/debian's libpq-dev installs libpq-fe.h to /usr/include/postgresql/,
not /usr/include/, so the previous fallback (cc -xc -fsyntax-only against
default include path) silently failed on linux. pg-bridge.o was never
built, the verify-vendor step caught the missing object, and ci #514's
build-linux-glibc job failed in 1m22s.
new detection order:
1. pg_config --includedir — works on any platform with libpq dev headers
2. brew --prefix libpq — keg-only on macos, no pg_config in PATH
3. /usr/include/postgresql/libpq-fe.h — debian/ubuntu fallback
4. default cc include path — last resort
also bumps the cache key (file content hash includes build-vendor.sh),
which forces ci to re-run build-vendor instead of restoring a stale
c_bridges/ from before libpq was installed.
---------
Co-authored-by: cs01 <cs01@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/stdlib/postgres.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@ PostgreSQL client via `libpq`. Connect to a Postgres database, run queries, and
6
6
import { Pool } from"chadscript/postgres";
7
7
```
8
8
9
-
`libpq` is required at build time. On macOS: `brew install libpq`. On Debian/Ubuntu: `apt install libpq-dev`.
9
+
`libpq` is required at build time. On Debian/Ubuntu: `apt install libpq-dev`. On macOS: `brew install libpq` then add `pg_config` to your `PATH` (libpq is keg-only) — `export PATH="/opt/homebrew/opt/libpq/bin:$PATH"`. Or `brew install postgresql@16` which puts `pg_config` on `PATH` automatically.
10
+
11
+
The build script discovers `libpq` via `pg_config --includedir`, so as long as `pg_config` is on `PATH` the bridge compiles cleanly. If `pg_config` is missing, `pg-bridge.o` is silently skipped and `import { Pool } from "chadscript/postgres"` fails to link.
0 commit comments