Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/actions/provision-cuda/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Provision CUDA Toolkit

description: Install CUDA toolkit for lloyal.node builds across all platforms

inputs:
version:
description: "CUDA toolkit version"
required: false
default: "12.6.2"
arch:
description: "Target architecture (x64 or arm64)"
required: true

outputs:
cuda-path:
description: "CUDA installation path"
value: ${{ steps.set-cuda-path.outputs.cuda-path }}

runs:
using: "composite"
steps:
# Windows: Install via Chocolatey
- name: Install CUDA (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
VERSION: ${{ inputs.version }}
run: |
$version = $env:VERSION
$version_major_minor = $version.Split('.')[0..1] -join '.'
$version_slug = $version_major_minor.Replace('.', '_')
$cuda_path = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version_major_minor}"

Write-Host "Installing CUDA ${version} via Chocolatey..."
choco install cuda --version=${version} -y --no-progress

# Set environment variables
Add-Content -Path $env:GITHUB_ENV -Value "CUDA_PATH=${cuda_path}"
Add-Content -Path $env:GITHUB_ENV -Value "CUDA_PATH_V${version_slug}=${cuda_path}"
Add-Content -Path $env:GITHUB_PATH -Value "${cuda_path}\bin"
Add-Content -Path $env:GITHUB_PATH -Value "${cuda_path}\libnvvp"

Write-Host "CUDA installed at: ${cuda_path}"

# Linux x64: Install from NVIDIA repos
- name: Install CUDA (Linux x64)
if: runner.os == 'Linux' && inputs.arch == 'x64'
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
version_major_minor=$(echo $VERSION | cut -d. -f1,2)
version_slug=$(echo $version_major_minor | tr '.' '-')

echo "Installing CUDA ${version_major_minor} for x86_64..."
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update -qq
sudo apt-get install -y -qq cuda-toolkit-${version_slug} build-essential cmake

cuda_path="/usr/local/cuda-${version_major_minor}"
echo "CUDA_PATH=${cuda_path}" >> $GITHUB_ENV
echo "${cuda_path}/bin" >> $GITHUB_PATH

echo "CUDA installed at: ${cuda_path}"

# Linux ARM64: Install from NVIDIA repos
- name: Install CUDA (Linux ARM64)
if: runner.os == 'Linux' && inputs.arch == 'arm64'
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
version_major_minor=$(echo $VERSION | cut -d. -f1,2)
version_slug=$(echo $version_major_minor | tr '.' '-')

echo "Installing CUDA ${version_major_minor} for arm64..."
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/arm64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update -qq
sudo apt-get install -y -qq cuda-toolkit-${version_slug} build-essential cmake

cuda_path="/usr/local/cuda-${version_major_minor}"
echo "CUDA_PATH=${cuda_path}" >> $GITHUB_ENV
echo "${cuda_path}/bin" >> $GITHUB_PATH

echo "CUDA installed at: ${cuda_path}"

# Set output
- name: Set CUDA path output
id: set-cuda-path
shell: bash
run: |
echo "cuda-path=${CUDA_PATH}" >> $GITHUB_OUTPUT
111 changes: 93 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,45 @@ jobs:
gpu: vulkan
package: linux-x64-vulkan

# Windows
# Windows x64
- os: windows-2022
arch: x64
gpu: cpu
package: win32-x64
- os: windows-2022
arch: x64
gpu: cuda
cuda_version: 12.2.0
package: win32-x64-cuda
- os: windows-2022
arch: x64
gpu: vulkan
package: win32-x64-vulkan

# Windows ARM64 (cross-compiled from x64)
- os: windows-2022
arch: arm64
gpu: cpu
package: win32-arm64
cross_compile: true
- os: windows-2022
arch: arm64
gpu: vulkan
package: win32-arm64-vulkan
cross_compile: true

# Linux ARM64 (native runners)
- os: ubuntu-22.04-arm
arch: arm64
gpu: cpu
package: linux-arm64
- os: ubuntu-22.04-arm
arch: arm64
gpu: cuda
package: linux-arm64-cuda
- os: ubuntu-22.04-arm
arch: arm64
gpu: vulkan
package: linux-arm64-vulkan

steps:
- name: Checkout code
Expand All @@ -57,45 +86,91 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
registry-url: 'https://registry.npmjs.org'

# Platform-specific dependencies
- name: Install build tools (Linux)
if: runner.os == 'Linux' && matrix.gpu == 'cpu'
- name: Install build tools (Linux x64)
if: runner.os == 'Linux' && matrix.arch == 'x64' && matrix.gpu == 'cpu'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake

- name: Install CUDA toolkit (Linux)
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
- name: Install build tools (Linux ARM64)
if: runner.os == 'Linux' && matrix.arch == 'arm64'
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install -y cuda-toolkit-12-2 build-essential cmake
sudo apt-get install -y build-essential cmake

- name: Provision CUDA toolkit
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
uses: ./.github/actions/provision-cuda
with:
version: '12.6.2'
arch: ${{ matrix.arch }}

- name: Install Vulkan SDK (Linux)
if: matrix.gpu == 'vulkan' && runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libvulkan-dev vulkan-tools
uses: jakoch/install-vulkan-sdk-action@v1.2.4
with:
vulkan_version: '1.4.313.0'
install_runtime: true
optional_components: com.lunarg.vulkan.arm64
cache: true
stripdown: true

- name: Install CUDA toolkit (Windows)
- name: Provision CUDA toolkit
if: matrix.gpu == 'cuda' && runner.os == 'Windows'
uses: Jimver/cuda-toolkit@v0.2.11
uses: ./.github/actions/provision-cuda
with:
cuda: '12.2.0'
version: '12.6.2'
arch: ${{ matrix.arch }}

- name: Install Vulkan SDK (Windows)
if: matrix.gpu == 'vulkan' && runner.os == 'Windows'
uses: jakoch/install-vulkan-sdk-action@v1.2.4
with:
vulkan_version: '1.4.313.0'
install_runtime: true
cache: true
stripdown: true

- name: Setup LLVM and Ninja for Windows ARM64 cross-compilation
if: runner.os == 'Windows' && matrix.cross_compile == true
shell: pwsh
run: |
# Install LLVM for cross-compilation
choco install llvm ninja -y

# Set environment for clang cross-compilation
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "CMAKE_GENERATOR=Ninja" | Out-File -FilePath $env:GITHUB_ENV -Append

# Build
- name: Install npm dependencies
run: npm install

- name: Build native module
- name: Build native module (Native builds)
if: matrix.cross_compile != true
run: npm run build
env:
LLOYAL_GPU: ${{ matrix.gpu }}

- name: Build native module (Windows ARM64 cross-compile)
if: runner.os == 'Windows' && matrix.cross_compile == true
shell: pwsh
run: |
# Set up cross-compilation environment
$env:CMAKE_GENERATOR = "Ninja"
$env:CMAKE_TOOLCHAIN_FILE = "${{ github.workspace }}/cmake/arm64-cross.cmake"

# Build with cross-compilation
npm run build
env:
LLOYAL_GPU: ${{ matrix.gpu }}
ARCH: arm64

# Package
- name: Create platform package
shell: bash
Expand All @@ -122,7 +197,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
registry-url: 'https://registry.npmjs.org'

- name: Sync package versions
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
node: [18, 20, 22]
node: [22, 24]

steps:
- name: Checkout code
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

- name: Pack package
run: npm pack
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
echo "Phase 1 Test Results"
echo "================================"
echo "✓ Vendor sources tested on Linux, macOS, Windows"
echo "✓ Node.js 18, 20, 22 compatibility verified"
echo "✓ Node.js 22, 24 (LTS) compatibility verified"
echo "✓ npm package contents verified"
echo "✓ API tests passed (11 tests)"
echo "✓ E2E tests passed (4 text generation + 8 embedding tests)"
Expand Down
Loading
Loading