ruvector/.github/workflows/build-native.yml
Claude f3f7a95752 feat: Add Neo4j-compatible hypergraph database package (ruvector-graph)
Major new package implementing a distributed hypergraph database with:

## Core Components (crates/ruvector-graph/)
- Cypher-compatible query parser with lexer, AST, optimizer
- Query execution engine with SIMD optimization and parallel execution
- ACID transaction support with MVCC isolation levels
- Distributed consensus and federation layer
- Vector-graph hybrid queries for AI/RAG workloads
- Performance optimizations (100x faster than Neo4j target)

## Bindings
- WASM bindings (crates/ruvector-graph-wasm/)
- NAPI-RS Node.js bindings (crates/ruvector-graph-node/)
- NPM packages for both targets

## CLI Integration
- 8 new graph commands: create, query, shell, import, export, info, benchmark, serve

## CI/CD
- Updated build-native.yml for graph packages
- New graph-ci.yml for testing and benchmarks
- New graph-release.yml for automated publishing

## Data Generation
- OpenRouter/Kimi K2 integration (packages/graph-data-generator/)
- Agentic-synth benchmark suite integration

## Tests & Benchmarks
- 11 test files covering all components
- Criterion benchmarks for performance validation
- Neo4j compatibility test suite

## Architecture Highlights
- CSR graph layout for cache-friendly access
- SIMD-vectorized query operators
- Roaring bitmaps for label indexes
- Bloom filters for fast negative lookups
- Adaptive radix tree for property indexes

Note: This is a comprehensive implementation created by 15 parallel agents.
Some integration fixes may be needed to resolve cross-module dependencies.

Co-authored-by: Claude AI Swarm <swarm@claude.ai>
2025-11-25 23:11:54 +00:00

314 lines
10 KiB
YAML

name: Build Native Modules
on:
push:
branches: [main]
tags:
- 'v*'
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
build: npm run build:napi -- --target x86_64-unknown-linux-gnu
platform: linux-x64-gnu
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
build: npm run build:napi -- --target aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-15-intel
target: x86_64-apple-darwin
build: npm run build:napi -- --target x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
target: aarch64-apple-darwin
build: npm run build:napi -- --target aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
target: x86_64-pc-windows-msvc
build: npm run build:napi -- --target x86_64-pc-windows-msvc
platform: win32-x64-msvc
name: Build ${{ matrix.settings.platform }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.settings.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.settings.platform == 'linux-arm64-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install dependencies
working-directory: npm
run: npm ci
- name: Build native module
working-directory: npm/packages/core
run: ${{ matrix.settings.build }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Find built .node files (debug)
shell: bash
run: |
echo "=== Searching entire workspace for .node files ==="
find . -name "*.node" -type f 2>/dev/null || true
echo "=== Checking npm/packages/core ==="
ls -la npm/packages/core/*.node 2>/dev/null || echo "No .node in npm/packages/core/"
ls -R npm/packages/core | grep "\.node" || echo "No .node files found"
- name: Copy binary to platform package
shell: bash
run: |
# NAPI-RS creates files as npm/packages/core/index.{platform}.node
# We need to copy them to npm/core/platforms/{platform}/ruvector.node
# Map platform names (NAPI-RS uses different naming for some platforms)
case "${{ matrix.settings.platform }}" in
linux-x64-gnu)
NAPI_PLATFORM="linux-x64-gnu"
;;
linux-arm64-gnu)
NAPI_PLATFORM="linux-arm64-gnu"
;;
darwin-x64)
NAPI_PLATFORM="darwin-x64"
;;
darwin-arm64)
NAPI_PLATFORM="darwin-arm64"
;;
win32-x64-msvc)
NAPI_PLATFORM="win32-x64-msvc"
;;
esac
SRC_FILE="npm/packages/core/index.${NAPI_PLATFORM}.node"
DEST_DIR="npm/core/platforms/${{ matrix.settings.platform }}"
DEST_FILE="${DEST_DIR}/ruvector.node"
echo "Looking for: $SRC_FILE"
ls -lah "$SRC_FILE" || {
echo "ERROR: Expected file not found: $SRC_FILE"
echo "Searching for any .node files..."
find npm/packages/core -name "*.node" -type f
exit 1
}
echo "Copying $SRC_FILE to $DEST_FILE"
mkdir -p "$DEST_DIR"
cp -v "$SRC_FILE" "$DEST_FILE"
echo "Verifying copy:"
ls -lah "$DEST_FILE"
- name: Test native module (native platform only)
if: |
(matrix.settings.platform == 'linux-x64-gnu' && runner.os == 'Linux') ||
(matrix.settings.platform == 'darwin-x64' && runner.os == 'macOS' && runner.arch == 'X64') ||
(matrix.settings.platform == 'darwin-arm64' && runner.os == 'macOS' && runner.arch == 'ARM64') ||
(matrix.settings.platform == 'win32-x64-msvc' && runner.os == 'Windows')
continue-on-error: true
working-directory: npm/packages/core
run: npm test
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.platform }}
path: npm/core/platforms/${{ matrix.settings.platform }}/*.node
if-no-files-found: error
build-graph:
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
build: npm run build:napi -- --target x86_64-unknown-linux-gnu
platform: linux-x64-gnu
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
build: npm run build:napi -- --target aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-15-intel
target: x86_64-apple-darwin
build: npm run build:napi -- --target x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
target: aarch64-apple-darwin
build: npm run build:napi -- --target aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
target: x86_64-pc-windows-msvc
build: npm run build:napi -- --target x86_64-pc-windows-msvc
platform: win32-x64-msvc
name: Build Graph ${{ matrix.settings.platform }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
key: graph-${{ matrix.settings.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.settings.platform == 'linux-arm64-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install dependencies
working-directory: npm
run: npm ci
- name: Build graph native module
working-directory: npm/packages/graph-node
run: ${{ matrix.settings.build }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Copy graph binary to platform package
shell: bash
run: |
case "${{ matrix.settings.platform }}" in
linux-x64-gnu)
NAPI_PLATFORM="linux-x64-gnu"
;;
linux-arm64-gnu)
NAPI_PLATFORM="linux-arm64-gnu"
;;
darwin-x64)
NAPI_PLATFORM="darwin-x64"
;;
darwin-arm64)
NAPI_PLATFORM="darwin-arm64"
;;
win32-x64-msvc)
NAPI_PLATFORM="win32-x64-msvc"
;;
esac
SRC_FILE="npm/packages/graph-node/index.${NAPI_PLATFORM}.node"
DEST_DIR="npm/graph/platforms/${{ matrix.settings.platform }}"
DEST_FILE="${DEST_DIR}/ruvector-graph.node"
echo "Looking for: $SRC_FILE"
ls -lah "$SRC_FILE" || {
echo "ERROR: Expected file not found: $SRC_FILE"
echo "Searching for any .node files..."
find npm/packages/graph-node -name "*.node" -type f
exit 1
}
echo "Copying $SRC_FILE to $DEST_FILE"
mkdir -p "$DEST_DIR"
cp -v "$SRC_FILE" "$DEST_FILE"
echo "Verifying copy:"
ls -lah "$DEST_FILE"
- name: Test graph module (native platform only)
if: |
(matrix.settings.platform == 'linux-x64-gnu' && runner.os == 'Linux') ||
(matrix.settings.platform == 'darwin-x64' && runner.os == 'macOS' && runner.arch == 'X64') ||
(matrix.settings.platform == 'darwin-arm64' && runner.os == 'macOS' && runner.arch == 'ARM64') ||
(matrix.settings.platform == 'win32-x64-msvc' && runner.os == 'Windows')
continue-on-error: true
working-directory: npm/packages/graph-node
run: npm test
- name: Upload graph artifact
uses: actions/upload-artifact@v4
with:
name: graph-bindings-${{ matrix.settings.platform }}
path: npm/graph/platforms/${{ matrix.settings.platform }}/*.node
if-no-files-found: error
publish:
name: Publish Platform Packages
runs-on: ubuntu-22.04
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Copy binaries to platform packages
run: |
for dir in artifacts/bindings-*/; do
platform=$(basename "$dir" | sed 's/bindings-//')
mkdir -p "npm/core/platforms/${platform}"
cp -v "$dir"/*.node "npm/core/platforms/${platform}/"
done
- name: Install dependencies
working-directory: npm
run: npm ci
- name: Publish platform packages
working-directory: npm/packages/core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run publish:platforms
- name: Publish main package
working-directory: npm/packages/ruvector
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public