graphdblite 0.1.2

Embedded graph database with Cypher support. SQLite-grade simplicity, graph-native performance.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
name: Build & Release

# Two trigger modes:
#   - workflow_dispatch  → republishes the rolling `dev-latest` prerelease.
#   - push of a v* tag   → publishes a fixed release at that tag.
# Both modes run the full 7-platform binary matrix (CLI, FFI, Node addon,
# Python wheels). Wheels are also pushed to PyPI by python-wheels.yml on
# the same tag-push event — kept in a separate workflow so the PyPI
# publishing step doesn't gate the GitHub release artifacts.

on:
  workflow_dispatch:
  push:
    tags:
      - "v*"

permissions:
  contents: write

# See ci.yml — bumps rustc's per-thread stack to avoid cold-cache
# typeck SIGSEGV.
env:
  RUST_MIN_STACK: 16777216

concurrency:
  group: dev-build
  cancel-in-progress: true

jobs:
  lint-workflows:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: actionlint
        run: |
          bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
          ./actionlint -color

  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      # fmt + clippy only need to run once. Skipping on macOS/Windows avoids
      # CRLF-vs-LF false positives from rustfmt on Windows checkouts and
      # cuts redundant work — the lint outcome is platform-independent.
      - if: matrix.os == 'ubuntu-latest'
        run: cargo fmt --check --all
      - if: matrix.os == 'ubuntu-latest'
        run: cargo clippy --all-targets --locked -- -D warnings
      - run: cargo test --workspace --locked

  build-cli:
    needs: [test, lint-workflows]
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            ext: tar.gz
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            ext: tar.gz
            cross: true
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            ext: tar.gz
            cross: true
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            ext: tar.gz
            cross: true
          - os: macos-latest
            target: aarch64-apple-darwin
            ext: tar.gz
          - os: macos-latest
            target: x86_64-apple-darwin
            ext: tar.gz
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            ext: zip
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross
        if: matrix.cross
        run: cargo install cross --locked

      - name: Build (native)
        if: ${{ !matrix.cross }}
        run: cargo build --release --bin graphdblite --target ${{ matrix.target }}

      - name: Build (cross)
        if: matrix.cross
        run: cross build --release --bin graphdblite --target ${{ matrix.target }}

      - name: Package (unix)
        if: runner.os != 'Windows'
        run: |
          tar czf graphdblite-${{ matrix.target }}.${{ matrix.ext }} \
            -C target/${{ matrix.target }}/release graphdblite

      - name: Package (windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          Compress-Archive -Path target\${{ matrix.target }}\release\graphdblite.exe `
            -DestinationPath graphdblite-${{ matrix.target }}.${{ matrix.ext }}

      - name: Checksum
        shell: bash
        run: |
          sha256sum graphdblite-${{ matrix.target }}.${{ matrix.ext }} \
            > graphdblite-${{ matrix.target }}.${{ matrix.ext }}.sha256

      - uses: actions/upload-artifact@v7
        with:
          name: cli-${{ matrix.target }}
          path: |
            graphdblite-${{ matrix.target }}.${{ matrix.ext }}
            graphdblite-${{ matrix.target }}.${{ matrix.ext }}.sha256

  build-ffi:
    needs: [test, lint-workflows]
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            cross: true
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            cross: true
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            cross: true
          - os: macos-latest
            target: aarch64-apple-darwin
          - os: macos-latest
            target: x86_64-apple-darwin
          # Two Windows builds:
          #   - MSVC: for C consumers, Node addon, Python wheel — Windows-native ABI.
          #   - GNU/MinGW: for Go cgo, which uses gcc-style linker invocations and
          #     expects a `libgraphdblite_ffi.a` static archive.
          - os: windows-latest
            target: x86_64-pc-windows-msvc
          - os: windows-latest
            target: x86_64-pc-windows-gnu
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross
        if: matrix.cross
        run: cargo install cross --locked

      # bindings/ffi/build.rs skips cbindgen when HOST != TARGET (cross
      # compile guard) and falls back to copying a pre-existing
      # bindings/ffi/graphdblite.h. Generate that header now via a host
      # `cargo check` — runs build.rs on the host arch and writes the
      # header to the crate root, where the cross build will pick it up.
      - name: Pre-generate FFI header (host)
        shell: bash
        run: cargo check -p graphdblite-ffi

      - name: Build (native)
        if: ${{ !matrix.cross }}
        run: cargo build --release -p graphdblite-ffi --target ${{ matrix.target }}

      - name: Build (cross)
        if: matrix.cross
        run: cross build --release -p graphdblite-ffi --target ${{ matrix.target }}

      - name: Package (unix)
        if: runner.os != 'Windows'
        shell: bash
        run: |
          mkdir -p staging
          cp bindings/ffi/graphdblite.h staging/
          cp target/${{ matrix.target }}/release/libgraphdblite_ffi.a staging/ 2>/dev/null || true
          cp target/${{ matrix.target }}/release/libgraphdblite_ffi.so staging/ 2>/dev/null || true
          cp target/${{ matrix.target }}/release/libgraphdblite_ffi.dylib staging/ 2>/dev/null || true
          tar czf graphdblite-ffi-${{ matrix.target }}.tar.gz -C staging .

      - name: Package (windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          New-Item -ItemType Directory -Path staging
          Copy-Item bindings\ffi\graphdblite.h staging\
          # MSVC outputs (x86_64-pc-windows-msvc): .dll, .dll.lib, .lib
          Copy-Item target\${{ matrix.target }}\release\graphdblite_ffi.dll staging\ -ErrorAction SilentlyContinue
          Copy-Item target\${{ matrix.target }}\release\graphdblite_ffi.dll.lib staging\ -ErrorAction SilentlyContinue
          Copy-Item target\${{ matrix.target }}\release\graphdblite_ffi.lib staging\ -ErrorAction SilentlyContinue
          # MinGW outputs (x86_64-pc-windows-gnu): libgraphdblite_ffi.a, .dll, .dll.a — for Go cgo
          Copy-Item target\${{ matrix.target }}\release\libgraphdblite_ffi.a staging\ -ErrorAction SilentlyContinue
          Copy-Item target\${{ matrix.target }}\release\libgraphdblite_ffi.dll.a staging\ -ErrorAction SilentlyContinue
          Compress-Archive -Path staging\* -DestinationPath graphdblite-ffi-${{ matrix.target }}.zip

      - name: Checksum
        shell: bash
        run: |
          for f in graphdblite-ffi-${{ matrix.target }}.*; do
            case "$f" in *.sha256) continue ;; esac
            sha256sum "$f" > "$f.sha256"
          done

      - uses: actions/upload-artifact@v7
        with:
          name: ffi-${{ matrix.target }}
          path: |
            graphdblite-ffi-${{ matrix.target }}.*

  build-node:
    needs: [test, lint-workflows]
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            use_zig: true
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            use_zig: true
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            use_zig: true
          - os: macos-latest
            target: aarch64-apple-darwin
          - os: macos-latest
            target: x86_64-apple-darwin
          - os: windows-latest
            target: x86_64-pc-windows-msvc
    runs-on: ${{ matrix.os }}
    defaults:
      run:
        working-directory: bindings/node
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - uses: actions/setup-node@v6
        with:
          node-version: "20"
      - run: npm install

      - name: Build (native)
        if: ${{ !matrix.use_zig }}
        run: npx napi build --platform --release --target ${{ matrix.target }}

      # Inline zig install (only on the ubuntu cross-compile legs of this
      # matrix). Previously used mlugg/setup-zig@v2, but that action's
      # JavaScript runtime is Node 20, which GitHub Actions force-migrates
      # to Node 24 on 2026-06-02 and removes entirely 2026-09-16. The
      # setup-zig project also moved primary hosting off GitHub, so the
      # GitHub mirror is unlikely to ship a Node-24 release in time.
      # Zig is a single static binary — install by hand.
      - name: Install zig
        if: matrix.use_zig
        working-directory: ${{ runner.temp }}
        run: |
          ZIG_VERSION=0.14.1
          # Note: official filename is `zig-x86_64-linux-X.Y.Z.tar.xz`
          # (target-host order, not host-target).
          curl -fsSL "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" \
            -o zig.tar.xz
          tar -xJf zig.tar.xz
          echo "${{ runner.temp }}/zig-x86_64-linux-${ZIG_VERSION}" >> "$GITHUB_PATH"

      - name: Build (zig cross)
        if: matrix.use_zig
        run: |
          zig version
          npx napi build --platform --release --target ${{ matrix.target }} --zig

      - uses: actions/upload-artifact@v7
        with:
          name: node-${{ matrix.target }}
          path: bindings/node/*.node

  # On tag push, publish the per-platform .node packages and the main
  # wrapper to npm. Uses a long-lived NPM_TOKEN; first publish; future
  # versions can migrate to npm trusted publishing once the package
  # exists on npm.
  publish-npm:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    needs: build-node
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: "22"
          registry-url: "https://registry.npmjs.org"
      - name: Install Node deps
        working-directory: bindings/node
        run: npm install
      - uses: actions/download-artifact@v8
        with:
          path: bindings/node/artifacts
          pattern: node-*
          merge-multiple: true
      - name: List downloaded artifacts
        working-directory: bindings/node
        run: ls -R artifacts
      - name: Stage per-platform npm packages
        working-directory: bindings/node
        run: |
          # napi-rs v2 CLI: command is `create-npm-dir` (singular).
          # Passing `-t .` makes it iterate the triples from package.json
          # rather than expecting a single target.
          npx napi create-npm-dir -t .
          npx napi artifacts --dir artifacts
          echo "--- npm tree ---"
          ls -R npm
      - name: Publish per-platform packages
        working-directory: bindings/node
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          for d in npm/*/; do
            echo "Publishing $d"
            (cd "$d" && npm publish --access public)
          done
      - name: Publish main wrapper
        working-directory: bindings/node
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npm publish --access public

  build-wheels:
    needs: [test, lint-workflows]
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64
            manylinux: "2_28"
          - os: ubuntu-latest
            target: x86_64
            manylinux: musllinux_1_2
          - os: ubuntu-latest
            target: aarch64
            manylinux: "2_28"
          - os: ubuntu-latest
            target: aarch64
            manylinux: musllinux_1_2
          - os: macos-latest
            target: x86_64
            manylinux: auto
          - os: macos-latest
            target: aarch64
            manylinux: auto
          - os: windows-latest
            target: x64
            manylinux: auto
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6

      - uses: astral-sh/setup-uv@v8.1.0
        # PyO3/maturin-action drives cibuildwheel which brings its own
        # per-target Pythons, but a host Python is still needed for the
        # action's prelude. uv installs one via python-build-standalone.

      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          args: --release --out dist --manifest-path bindings/python/Cargo.toml
          manylinux: ${{ matrix.manylinux }}

      - uses: actions/upload-artifact@v7
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux }}
          path: dist/*.whl

  test-go:
    needs: build-ffi
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-go@v6
        with:
          go-version: "1.26"
          cache: false  # binding has no non-stdlib deps; no go.sum to key on
      - name: Build FFI and run Go tests
        run: make -C bindings/go test

  test-ffi-conformance:
    needs: [test, lint-workflows]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - name: Build FFI and run C conformance suite
        run: make -C bindings/ffi conformance

  test-python-conformance:
    needs: [test, lint-workflows]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: astral-sh/setup-uv@v8.1.0
        # uv handles Python install — no separate actions/setup-python step.
      - name: Build and install Python binding
        working-directory: bindings/python
        run: |
          uv venv --python 3.13
          uv pip install maturin pytest
          uv run maturin develop --release
      - name: Run conformance suite
        working-directory: bindings/python
        run: uv run pytest tests/conformance/ -v

  test-node-conformance:
    needs: [test, lint-workflows]
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: bindings/node
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-node@v6
        with:
          node-version: "20"
      - run: npm install
      - name: Build native addon
        run: npx napi build --platform --release
      - name: Run conformance suite
        run: npm test

  # Common artifact-collection job — runs for both dev-latest and tag releases.
  # Publishes nothing on its own; the two publish-* jobs below consume its
  # uploaded artifacts.
  collect-artifacts:
    needs: [build-cli, build-ffi, build-node, build-wheels, test-go, test-ffi-conformance, test-python-conformance, test-node-conformance]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v8
        with:
          pattern: cli-*
          merge-multiple: true
          path: cli/
      - uses: actions/download-artifact@v8
        with:
          pattern: ffi-*
          merge-multiple: true
          path: ffi/
      - uses: actions/download-artifact@v8
        with:
          pattern: node-*
          merge-multiple: true
          path: node/
      - uses: actions/download-artifact@v8
        with:
          pattern: wheels-*
          merge-multiple: true
          path: wheels/
      - name: Combine checksums
        run: cat cli/*.sha256 ffi/*.sha256 > sha256sums.txt
      - uses: actions/upload-artifact@v7
        with:
          name: release-bundle
          path: |
            cli/
            ffi/
            node/
            wheels/
            sha256sums.txt

  publish-dev-latest:
    if: github.event_name == 'workflow_dispatch'
    needs: collect-artifacts
    runs-on: ubuntu-latest
    env:
      GH_TOKEN: ${{ github.token }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/download-artifact@v8
        with:
          name: release-bundle
          path: bundle/
      - name: Replace rolling dev-latest release
        run: |
          gh release delete dev-latest --yes --cleanup-tag || true
          gh release create dev-latest \
            --title "Dev Build (latest main)" \
            --notes "Rolling development build from main branch.
          Commit: ${{ github.sha }}
          Date: $(date -u +%Y-%m-%d)

          ## Artifacts
          - **CLI binaries**: Linux (x86_64, arm64, musl x86_64, musl arm64), macOS (x86_64, arm64), Windows (x86_64)
          - **Python wheels**: full PyPI matrix (glibc + musl Linux, macOS, Windows)
          - **C FFI libraries**: same 7 targets as CLI, plus Windows MinGW for Go cgo
          - **Node.js addons**: same 7 targets as CLI" \
            --prerelease \
            --target ${{ github.sha }} \
            bundle/cli/graphdblite-*.tar.gz bundle/cli/graphdblite-*.zip bundle/sha256sums.txt \
            bundle/ffi/graphdblite-ffi-*.tar.gz bundle/ffi/graphdblite-ffi-*.zip \
            bundle/node/*.node \
            bundle/wheels/*.whl

  publish-tag-release:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
    needs: collect-artifacts
    runs-on: ubuntu-latest
    env:
      GH_TOKEN: ${{ github.token }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/download-artifact@v8
        with:
          name: release-bundle
          path: bundle/
      - name: Create release for ${{ github.ref_name }}
        run: |
          gh release create "${{ github.ref_name }}" \
            --title "${{ github.ref_name }}" \
            --notes "Release ${{ github.ref_name }}.
          Commit: ${{ github.sha }}

          ## Artifacts
          - **CLI binaries**: Linux (x86_64, arm64, musl x86_64, musl arm64), macOS (x86_64, arm64), Windows (x86_64)
          - **Python wheels**: full PyPI matrix (glibc + musl Linux, macOS, Windows)
          - **C FFI libraries**: same 7 targets as CLI, plus Windows MinGW for Go cgo
          - **Node.js addons**: same 7 targets as CLI

          See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md) for details." \
            bundle/cli/graphdblite-*.tar.gz bundle/cli/graphdblite-*.zip bundle/sha256sums.txt \
            bundle/ffi/graphdblite-ffi-*.tar.gz bundle/ffi/graphdblite-ffi-*.zip \
            bundle/node/*.node \
            bundle/wheels/*.whl