Skip to content

feat(api): remove flat ctx inference path, make branch API the only path #133

feat(api): remove flat ctx inference path, make branch API the only path

feat(api): remove flat ctx inference path, make branch API the only path #133

Workflow file for this run

name: Build & Test
on:
pull_request:
branches: [ main ]
jobs:
test-build:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache test models
uses: actions/cache@v4
with:
path: models/
key: test-models-v1-${{ hashFiles('test/matrix.json') }}
- name: Download test models
run: bash scripts/download-test-models.sh
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Install build dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cmake
- name: Install build dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
# MSVC already available on GitHub runners
- name: Verify submodules exist
run: |
node -e "const fs = require('fs'); if (!fs.existsSync('llama.cpp/CMakeLists.txt')) throw new Error('llama.cpp submodule missing! Run: git submodule update --init --recursive'); console.log('✓ Submodules found');"
- name: Validate llama.cpp version
run: node scripts/sync-llama-cpp.js --check
shell: bash
- name: Install npm dependencies
run: npm install --ignore-scripts
- name: Build from submodules
run: npm run build
env:
# Force CPU — GitHub Actions paravirtual Metal GPU has driver bugs
LLOYAL_GPU: cpu
# This runs scripts/build.js which:
# 1. Builds llama.cpp from llama.cpp/
# 2. Builds liblloyal from liblloyal/
# 3. Builds N-API addon with cmake-js
- name: Verify build outputs
run: |
node -e "const fs = require('fs'); const files = fs.readdirSync('build/Release'); console.log('Build outputs:', files); if (!files.some(f => f.endsWith('.node'))) throw new Error('No .node file built!');"
- name: Run integration tests (Windows)
if: runner.os == 'Windows'
run: |
$env:PATH = "${{ github.workspace }}\build\Release;$env:PATH"
npm run test:integration
timeout-minutes: 10
env:
LLOYAL_LOCAL: '1'
- name: Run integration tests (Unix)
if: runner.os != 'Windows'
run: npm run test:integration
timeout-minutes: 10
env:
LLOYAL_LOCAL: '1'
- name: Display build info
if: always()
run: |
echo "================================"
echo "Build Information"
echo "================================"
echo "OS: ${{ runner.os }}"
echo "Node: 24"
echo "Platform: $(node -p 'process.platform')"
echo "Arch: $(node -p 'process.arch')"
echo "Build system: cmake-js"
echo "llama.cpp: $(cd llama.cpp && git rev-parse --short HEAD)"
echo "liblloyal: $(cd liblloyal && git rev-parse --short HEAD)"
shell: bash
- name: Upload build artifacts (failures only)
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-failure-${{ matrix.os }}
path: |
build/
build/CMakeCache.txt
build/CMakeFiles/CMakeError.log
retention-days: 7
verify-npm-package:
name: Verify npm package contents
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# No submodules needed - npm package doesn't include sources
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Pack package
run: npm pack
- name: Extract and verify tarball
run: |
tar -tzf lloyal-labs-lloyal.node-*.tgz > package-contents.txt
echo "📦 Package contents:"
cat package-contents.txt
# Verify lib/ JavaScript is included
if ! grep -q "package/lib/index.js" package-contents.txt; then
echo "❌ ERROR: lib/index.js not in package!"
exit 1
fi
# Verify submodules are NOT included (they're huge)
if grep -q "package/llama.cpp/" package-contents.txt; then
echo "❌ ERROR: llama.cpp/ should not be in package!"
exit 1
fi
if grep -q "package/liblloyal/" package-contents.txt; then
echo "❌ ERROR: liblloyal/ should not be in package!"
exit 1
fi
# Verify build artifacts are NOT included
if grep -q "package/build/" package-contents.txt; then
echo "❌ ERROR: build/ should not be in package!"
exit 1
fi
echo "✅ Package contents verified!"
- name: Upload package for inspection
uses: actions/upload-artifact@v4
with:
name: npm-package
path: lloyal-labs-lloyal.node-*.tgz
retention-days: 7
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-build, verify-npm-package]
if: always()
steps:
- name: Check test results
run: |
echo "================================"
echo "Test Results Summary"
echo "================================"
echo "✓ Source builds tested on Linux, macOS, and Windows"
echo "✓ Node.js 24 (Active LTS) compatibility verified"
echo "✓ npm package contents verified"
echo "✓ Integration tests passed"
echo "✓ Model matrix tested on GPU (gpu-test.yml)"
echo ""
echo "Build & Test Status: ${{ needs.test-build.result }}"