Skip to content

Commit 9fcd5b4

Browse files
Merge pull request #4 from lloyal-ai/feat/metrics
feat(metrics+distribution): SessionContext bindings and update distribution matrix
2 parents ae09575 + c64edfa commit 9fcd5b4

32 files changed

Lines changed: 2494 additions & 1566 deletions
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Provision CUDA Toolkit
2+
3+
description: Install CUDA toolkit for lloyal.node builds across all platforms
4+
5+
inputs:
6+
version:
7+
description: "CUDA toolkit version"
8+
required: false
9+
default: "12.6.2"
10+
arch:
11+
description: "Target architecture (x64 or arm64)"
12+
required: true
13+
14+
outputs:
15+
cuda-path:
16+
description: "CUDA installation path"
17+
value: ${{ steps.set-cuda-path.outputs.cuda-path }}
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
# Windows: Install via Chocolatey
23+
- name: Install CUDA (Windows)
24+
if: runner.os == 'Windows'
25+
shell: pwsh
26+
env:
27+
VERSION: ${{ inputs.version }}
28+
run: |
29+
$version = $env:VERSION
30+
$version_major_minor = $version.Split('.')[0..1] -join '.'
31+
$version_slug = $version_major_minor.Replace('.', '_')
32+
$cuda_path = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version_major_minor}"
33+
34+
Write-Host "Installing CUDA ${version} via Chocolatey..."
35+
choco install cuda --version=${version} -y --no-progress
36+
37+
# Set environment variables
38+
Add-Content -Path $env:GITHUB_ENV -Value "CUDA_PATH=${cuda_path}"
39+
Add-Content -Path $env:GITHUB_ENV -Value "CUDA_PATH_V${version_slug}=${cuda_path}"
40+
Add-Content -Path $env:GITHUB_PATH -Value "${cuda_path}\bin"
41+
Add-Content -Path $env:GITHUB_PATH -Value "${cuda_path}\libnvvp"
42+
43+
Write-Host "CUDA installed at: ${cuda_path}"
44+
45+
# Linux x64: Install from NVIDIA repos
46+
- name: Install CUDA (Linux x64)
47+
if: runner.os == 'Linux' && inputs.arch == 'x64'
48+
shell: bash
49+
env:
50+
VERSION: ${{ inputs.version }}
51+
run: |
52+
version_major_minor=$(echo $VERSION | cut -d. -f1,2)
53+
version_slug=$(echo $version_major_minor | tr '.' '-')
54+
55+
echo "Installing CUDA ${version_major_minor} for x86_64..."
56+
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
57+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
58+
sudo apt-get update -qq
59+
sudo apt-get install -y -qq cuda-toolkit-${version_slug} build-essential cmake
60+
61+
cuda_path="/usr/local/cuda-${version_major_minor}"
62+
echo "CUDA_PATH=${cuda_path}" >> $GITHUB_ENV
63+
echo "${cuda_path}/bin" >> $GITHUB_PATH
64+
65+
echo "CUDA installed at: ${cuda_path}"
66+
67+
# Linux ARM64: Install from NVIDIA repos
68+
- name: Install CUDA (Linux ARM64)
69+
if: runner.os == 'Linux' && inputs.arch == 'arm64'
70+
shell: bash
71+
env:
72+
VERSION: ${{ inputs.version }}
73+
run: |
74+
version_major_minor=$(echo $VERSION | cut -d. -f1,2)
75+
version_slug=$(echo $version_major_minor | tr '.' '-')
76+
77+
echo "Installing CUDA ${version_major_minor} for arm64..."
78+
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/arm64/cuda-keyring_1.1-1_all.deb
79+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
80+
sudo apt-get update -qq
81+
sudo apt-get install -y -qq cuda-toolkit-${version_slug} build-essential cmake
82+
83+
cuda_path="/usr/local/cuda-${version_major_minor}"
84+
echo "CUDA_PATH=${cuda_path}" >> $GITHUB_ENV
85+
echo "${cuda_path}/bin" >> $GITHUB_PATH
86+
87+
echo "CUDA installed at: ${cuda_path}"
88+
89+
# Set output
90+
- name: Set CUDA path output
91+
id: set-cuda-path
92+
shell: bash
93+
run: |
94+
echo "cuda-path=${CUDA_PATH}" >> $GITHUB_OUTPUT

.github/workflows/release.yml

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,45 @@ jobs:
3737
gpu: vulkan
3838
package: linux-x64-vulkan
3939

40-
# Windows
40+
# Windows x64
4141
- os: windows-2022
4242
arch: x64
4343
gpu: cpu
4444
package: win32-x64
4545
- os: windows-2022
4646
arch: x64
4747
gpu: cuda
48-
cuda_version: 12.2.0
4948
package: win32-x64-cuda
49+
- os: windows-2022
50+
arch: x64
51+
gpu: vulkan
52+
package: win32-x64-vulkan
53+
54+
# Windows ARM64 (cross-compiled from x64)
55+
- os: windows-2022
56+
arch: arm64
57+
gpu: cpu
58+
package: win32-arm64
59+
cross_compile: true
60+
- os: windows-2022
61+
arch: arm64
62+
gpu: vulkan
63+
package: win32-arm64-vulkan
64+
cross_compile: true
65+
66+
# Linux ARM64 (native runners)
67+
- os: ubuntu-22.04-arm
68+
arch: arm64
69+
gpu: cpu
70+
package: linux-arm64
71+
- os: ubuntu-22.04-arm
72+
arch: arm64
73+
gpu: cuda
74+
package: linux-arm64-cuda
75+
- os: ubuntu-22.04-arm
76+
arch: arm64
77+
gpu: vulkan
78+
package: linux-arm64-vulkan
5079

5180
steps:
5281
- name: Checkout code
@@ -57,45 +86,91 @@ jobs:
5786
- name: Setup Node.js
5887
uses: actions/setup-node@v4
5988
with:
60-
node-version: 20
89+
node-version: 24
6190
registry-url: 'https://registry.npmjs.org'
6291

6392
# Platform-specific dependencies
64-
- name: Install build tools (Linux)
65-
if: runner.os == 'Linux' && matrix.gpu == 'cpu'
93+
- name: Install build tools (Linux x64)
94+
if: runner.os == 'Linux' && matrix.arch == 'x64' && matrix.gpu == 'cpu'
6695
run: |
6796
sudo apt-get update
6897
sudo apt-get install -y build-essential cmake
6998
70-
- name: Install CUDA toolkit (Linux)
71-
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
99+
- name: Install build tools (Linux ARM64)
100+
if: runner.os == 'Linux' && matrix.arch == 'arm64'
72101
run: |
73-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
74-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
75102
sudo apt-get update
76-
sudo apt-get install -y cuda-toolkit-12-2 build-essential cmake
103+
sudo apt-get install -y build-essential cmake
104+
105+
- name: Provision CUDA toolkit
106+
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
107+
uses: ./.github/actions/provision-cuda
108+
with:
109+
version: '12.6.2'
110+
arch: ${{ matrix.arch }}
77111

78112
- name: Install Vulkan SDK (Linux)
79113
if: matrix.gpu == 'vulkan' && runner.os == 'Linux'
80-
run: |
81-
sudo apt-get update
82-
sudo apt-get install -y build-essential cmake libvulkan-dev vulkan-tools
114+
uses: jakoch/install-vulkan-sdk-action@v1.2.4
115+
with:
116+
vulkan_version: '1.4.313.0'
117+
install_runtime: true
118+
optional_components: com.lunarg.vulkan.arm64
119+
cache: true
120+
stripdown: true
83121

84-
- name: Install CUDA toolkit (Windows)
122+
- name: Provision CUDA toolkit
85123
if: matrix.gpu == 'cuda' && runner.os == 'Windows'
86-
uses: Jimver/cuda-toolkit@v0.2.11
124+
uses: ./.github/actions/provision-cuda
87125
with:
88-
cuda: '12.2.0'
126+
version: '12.6.2'
127+
arch: ${{ matrix.arch }}
128+
129+
- name: Install Vulkan SDK (Windows)
130+
if: matrix.gpu == 'vulkan' && runner.os == 'Windows'
131+
uses: jakoch/install-vulkan-sdk-action@v1.2.4
132+
with:
133+
vulkan_version: '1.4.313.0'
134+
install_runtime: true
135+
cache: true
136+
stripdown: true
137+
138+
- name: Setup LLVM and Ninja for Windows ARM64 cross-compilation
139+
if: runner.os == 'Windows' && matrix.cross_compile == true
140+
shell: pwsh
141+
run: |
142+
# Install LLVM for cross-compilation
143+
choco install llvm ninja -y
144+
145+
# Set environment for clang cross-compilation
146+
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Append
147+
echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Append
148+
echo "CMAKE_GENERATOR=Ninja" | Out-File -FilePath $env:GITHUB_ENV -Append
89149
90150
# Build
91151
- name: Install npm dependencies
92152
run: npm install
93153

94-
- name: Build native module
154+
- name: Build native module (Native builds)
155+
if: matrix.cross_compile != true
95156
run: npm run build
96157
env:
97158
LLOYAL_GPU: ${{ matrix.gpu }}
98159

160+
- name: Build native module (Windows ARM64 cross-compile)
161+
if: runner.os == 'Windows' && matrix.cross_compile == true
162+
shell: pwsh
163+
run: |
164+
# Set up cross-compilation environment
165+
$env:CMAKE_GENERATOR = "Ninja"
166+
$env:CMAKE_TOOLCHAIN_FILE = "${{ github.workspace }}/cmake/arm64-cross.cmake"
167+
168+
# Build with cross-compilation
169+
npm run build
170+
env:
171+
LLOYAL_GPU: ${{ matrix.gpu }}
172+
ARCH: arm64
173+
99174
# Package
100175
- name: Create platform package
101176
shell: bash
@@ -122,7 +197,7 @@ jobs:
122197
- name: Setup Node.js
123198
uses: actions/setup-node@v4
124199
with:
125-
node-version: 20
200+
node-version: 24
126201
registry-url: 'https://registry.npmjs.org'
127202

128203
- name: Sync package versions

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest, macos-14, windows-latest]
18-
node: [18, 20, 22]
18+
node: [22, 24]
1919

2020
steps:
2121
- name: Checkout code
@@ -133,7 +133,7 @@ jobs:
133133
- name: Setup Node.js
134134
uses: actions/setup-node@v4
135135
with:
136-
node-version: 20
136+
node-version: 24
137137

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

0 commit comments

Comments
 (0)