Skip to content

Native N-API backend for libpg_query (PG 18) with jemalloc #10

Native N-API backend for libpg_query (PG 18) with jemalloc

Native N-API backend for libpg_query (PG 18) with jemalloc #10

Workflow file for this run

name: Native CI
on:
push:
branches: [napi-jemalloc, main]
paths:
- "native/**"
- ".github/workflows/native-ci.yml"
- ".github/workflows/native-build.yml"
pull_request:
paths:
- "native/**"
- ".github/workflows/native-ci.yml"
- ".github/workflows/native-build.yml"
jobs:
build:
name: Build
uses: ./.github/workflows/native-build.yml
with:
upload-retention-days: 3
package-test-matrix:
name: Generate package test matrix
runs-on: ubuntu-24.04
outputs:
include: ${{ steps.gen.outputs.include }}
steps:
- uses: actions/checkout@v5
- id: gen
run: |
include=$(node -e "
const p = require('./native/platforms.json');
const matrix = Object.entries(p).map(([key, v]) => ({
platform: key,
runner: v.runner,
container: v.container || '',
musl: (v.libc || []).includes('musl'),
}));
console.log(JSON.stringify(matrix));
")
echo "include=${include}" >> "$GITHUB_OUTPUT"
package-test:
name: Package test ${{ matrix.platform }}
needs: [build, package-test-matrix]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.package-test-matrix.outputs.include) }}
container: ${{ matrix.container || '' }}
steps:
- name: Install Alpine deps
if: matrix.musl
run: apk add --no-cache git
- uses: actions/checkout@v5
- name: Setup Node.js
if: "!matrix.musl"
uses: actions/setup-node@v6
with:
node-version: "20"
package-manager-cache: false
- name: Download prebuild
uses: actions/download-artifact@v5
with:
name: prebuild-${{ matrix.platform }}
path: native/prebuilds/${{ matrix.platform }}
- name: Build TS and pack tarballs
working-directory: native
run: |
npm install
npx tsc
node scripts/package-platforms.mjs
# Pack the main package and this platform's package into tarballs.
# Tarballs install cleanly without registry lookups for the (unpublished)
# platform optionalDependencies. --pack-destination requires the dir to exist.
mkdir -p "$GITHUB_WORKSPACE/native/dist-packs"
npm pack --pack-destination "$GITHUB_WORKSPACE/native/dist-packs"
(cd "packages/libpg-query-native-${{ matrix.platform }}" \
&& npm pack --pack-destination "$GITHUB_WORKSPACE/native/dist-packs")
echo "Packed:"; ls -1 "$GITHUB_WORKSPACE/native/dist-packs"
- name: Install package in isolated directory
run: |
mkdir -p /tmp/smoke-test
cd /tmp/smoke-test
npm init -y >/dev/null
# --omit=optional skips the main package's unpublished platform deps;
# the matching platform tarball is installed explicitly alongside it.
npm install --omit=optional "$GITHUB_WORKSPACE/native/dist-packs/"*.tgz
echo "Installed @ashbyhq packages:"
ls node_modules/@ashbyhq
- name: Run smoke test
run: |
cd /tmp/smoke-test
cp "$GITHUB_WORKSPACE/native/test/smoke.mjs" smoke.mjs
node smoke.mjs