Skip to content
Open
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
45 changes: 43 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build CLI
Expand All @@ -25,8 +29,8 @@ jobs:
name: pg0-macos
path: target/release/pg0

sdk-tests:
name: SDK Tests (macOS)
python-sdk-tests:
name: Python SDK Tests (macOS)
needs: build
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -56,6 +60,43 @@ jobs:
uv pip install --system -e ".[dev]"
pytest tests/ -v

node-sdk-tests:
name: Node.js SDK Tests (macOS)
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Download CLI
uses: actions/download-artifact@v4
with:
name: pg0-macos
path: ~/.local/bin

- name: Make CLI executable
run: chmod +x ~/.local/bin/pg0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: sdk/node/package-lock.json

- name: Install dependencies
working-directory: sdk/node
run: npm ci

- name: Build
working-directory: sdk/node
run: npm run build

- name: Run tests
working-directory: sdk/node
run: |
export PATH="$HOME/.local/bin:$PATH"
npm test

# Docker tests - one job per platform, runs both CLI and Python SDK tests
# Note: ARM64 tests are skipped because QEMU emulation is too slow for PostgreSQL setup
docker-tests:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: sdk/node/package-lock.json

- name: Install dependencies
working-directory: sdk/node
Expand Down
6 changes: 4 additions & 2 deletions sdk/node/dist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ function findPg0Sync() {
// Check PATH
const { execSync } = require("child_process");
try {
const result = execSync("which pg0 2>/dev/null || where pg0 2>nul", { encoding: "utf-8" });
const cmd = process.platform === "win32" ? "where pg0" : "which pg0";
const result = execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
if (result.trim())
return result.trim().split("\n")[0];
}
Expand Down Expand Up @@ -181,7 +182,8 @@ async function findPg0() {
// Check PATH
const { execSync } = require("child_process");
try {
const result = execSync("which pg0 2>/dev/null || where pg0 2>nul", { encoding: "utf-8" });
const cmd = process.platform === "win32" ? "where pg0" : "which pg0";
const result = execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
if (result.trim())
return result.trim().split("\n")[0];
}
Expand Down
6 changes: 4 additions & 2 deletions sdk/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ function findPg0Sync(): string {
// Check PATH
const { execSync } = require("child_process");
try {
const result = execSync("which pg0 2>/dev/null || where pg0 2>nul", { encoding: "utf-8" });
const cmd = process.platform === "win32" ? "where pg0" : "which pg0";
const result = execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
if (result.trim()) return result.trim().split("\n")[0];
} catch {
// Not in PATH
Expand Down Expand Up @@ -221,7 +222,8 @@ async function findPg0(): Promise<string> {
// Check PATH
const { execSync } = require("child_process");
try {
const result = execSync("which pg0 2>/dev/null || where pg0 2>nul", { encoding: "utf-8" });
const cmd = process.platform === "win32" ? "where pg0" : "which pg0";
const result = execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
if (result.trim()) return result.trim().split("\n")[0];
} catch {
// Not in PATH
Expand Down
Loading