Skip to content

feat: Node bindings #14

feat: Node bindings

feat: Node bindings #14

Workflow file for this run

name: Node Test
on:
workflow_call: { }
workflow_dispatch: { }
pull_request:
paths:
- bindings/node/**
- src/**
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install pre-commit
run: |
npm install -g pre-commit
- name: Run pre-commit
shell: bash
run: |
pre-commit run --all-files prettier
continue-on-error: true
build:
name: Build and Test
runs-on: ${{ matrix.os }}
needs: [ lint ]
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] #, windows-latest, macos-latest, macos-14, ubuntu-latest,
steps:
- uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Dependencies
if: matrix.os == 'ubuntu-latest'
id: depends
run: |
sudo apt-get update
sudo apt-get install build-essential libcurl4-openssl-dev libomp-dev
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.os == 'ubuntu-latest'
- name: Install Ninja
if: matrix.os == 'windows-latest'
id: install_ninja
run: |
choco install ninja
- name: Set Mac Env
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
run: |
echo "CMAKE_FLAGS=-DGGML_METAL_EMBED_LIBRARY=ON" >> $GITHUB_ENV
echo "SHARED_LIB_PATH=../../build" >> $GITHUB_ENV
echo "CMAKE_BUILD_FLAGS=-j$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
- name: Set Linux Env
if: matrix.os == 'ubuntu-latest'
run: |
echo "SHARED_LIB_PATH=../../build" >> $GITHUB_ENV
echo "CMAKE_BUILD_FLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Set Windows Env
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_ENV -Value "SHARED_LIB_PATH=../../build/Release"
Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_BUILD_FLAGS=-j$env:NUMBER_OF_PROCESSORS"
Get-ChildItem -Path .\build -Recurse -Directory
- name: Build and Test
run: |
make node-test
env:
GTEST_COLOR: yes
GTEST_OUTPUT: xml:test_results.xml
SHARED_LIB_PATH: ${{ env.SHARED_LIB_PATH }}
CMAKE_FLAGS: ${{ env.CMAKE_FLAGS }}
CMAKE_BUILD_FLAGS: ${{ env.CMAKE_BUILD_FLAGS }}
# - name: List dirs
# if: always() && matrix.os == 'windows-latest'
# shell: pwsh
# run: |
# Get-ChildItem -Path .\build -Recurse
# - name: Setup tmate session
# if: always() && matrix.os == 'windows-latest'
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true