Skip to content

fix(ci): revert to standard container + provision cuda #3

fix(ci): revert to standard container + provision cuda

fix(ci): revert to standard container + provision cuda #3

Workflow file for this run

name: GPU Builds (CUDA/Vulkan)
on:
push:
branches:
- 'feat/cuda-vulkan'
jobs:
build-and-test:
name: Build & Test ${{ matrix.package }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x64 GPU
- os: ubuntu-22.04
arch: x64
gpu: cuda
package: linux-x64-cuda
- os: ubuntu-22.04
arch: x64
gpu: vulkan
package: linux-x64-vulkan
# Linux ARM64 GPU
- 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
# Windows x64 GPU
- os: windows-2022
arch: x64
gpu: cuda
package: win32-x64-cuda
- os: windows-2022
arch: x64
gpu: vulkan
package: win32-x64-vulkan
# Windows ARM64 Vulkan (cross-compiled)
- os: windows-2022
arch: arm64
gpu: vulkan
package: win32-arm64-vulkan
cross_compile: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
# Linux build tools
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
# CUDA
- name: Provision CUDA toolkit (Linux)
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
uses: ./.github/actions/provision-cuda
with:
version: '12.6.2'
arch: ${{ matrix.arch }}
- name: Provision CUDA toolkit (Windows)
if: matrix.gpu == 'cuda' && runner.os == 'Windows'
uses: ./.github/actions/provision-cuda
with:
version: '12.6.2'
arch: ${{ matrix.arch }}
# Vulkan
- name: Install Vulkan SDK (Linux)
if: matrix.gpu == 'vulkan' && runner.os == 'Linux'
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 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
# Windows ARM64 cross-compile setup
- name: Setup LLVM and Ninja for Windows ARM64 cross-compilation
if: runner.os == 'Windows' && matrix.cross_compile == true
shell: pwsh
run: |
choco install llvm ninja -y
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 --ignore-scripts
- 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: |
$env:CMAKE_GENERATOR = "Ninja"
$env:CMAKE_TOOLCHAIN_FILE = "${{ github.workspace }}/cmake/arm64-cross.cmake"
npm run build
env:
LLOYAL_GPU: ${{ matrix.gpu }}
ARCH: arm64
# Create platform package
- name: Create platform package
shell: bash
run: |
node scripts/create-platform-package.js "${{ matrix.package }}" "${{ matrix.os }}" "${{ matrix.arch }}"
# Test (skip for cross-compiled and CUDA - no GPU in CI)
- name: Cache test models
if: matrix.cross_compile != true && matrix.gpu != 'cuda'
uses: actions/cache@v4
with:
path: models/
key: test-models-v1
- name: Download test models
if: matrix.cross_compile != true && matrix.gpu != 'cuda'
run: bash scripts/download-test-models.sh
- name: Install platform package locally
if: matrix.cross_compile != true && matrix.gpu != 'cuda'
shell: bash
run: |
npm install ./packages/${{ matrix.package }}
rm -rf build/Release
echo "Installed package contents:"
ls -la node_modules/@lloyal-labs/lloyal.node-${{ matrix.package }}/bin/ || echo "Package not found in node_modules"
- name: Verify platform package loading (Unix)
if: runner.os != 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
shell: bash
run: |
# Set LD_LIBRARY_PATH to find sibling .so files (Linux CUDA/Vulkan)
PKG_BIN="$PWD/node_modules/@lloyal-labs/lloyal.node-${{ matrix.package }}/bin"
export LD_LIBRARY_PATH="${PKG_BIN}:${LD_LIBRARY_PATH:-}"
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
node -e "
const { loadBinary } = require('./lib');
const addon = loadBinary();
console.log('✓ Platform package loaded successfully');
console.log(' Exports:', Object.keys(addon));
"
env:
LLOYAL_GPU: ${{ matrix.gpu }}
LLOYAL_NO_FALLBACK: '1'
- name: Verify platform package loading (Windows)
if: runner.os == 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
shell: pwsh
run: |
# Add package bin to PATH for DLL discovery
$pkgBin = "$PWD\node_modules\@lloyal-labs\lloyal.node-${{ matrix.package }}\bin"
$env:PATH = "$pkgBin;$env:PATH"
# Add Vulkan SDK runtime to PATH if available
if ($env:VULKAN_SDK) {
$env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH"
Write-Host "Added Vulkan SDK Bin to PATH: $env:VULKAN_SDK\Bin"
Write-Host "Vulkan SDK Bin contents:"
Get-ChildItem "$env:VULKAN_SDK\Bin" -Filter "*.dll" | Select-Object Name
}
Write-Host "Package bin: $pkgBin"
Write-Host "Package bin contents:"
Get-ChildItem $pkgBin
Write-Host "VULKAN_SDK: $env:VULKAN_SDK"
# Check if vulkan-1.dll exists
$vulkanDll = "$env:VULKAN_SDK\Bin\vulkan-1.dll"
if (Test-Path $vulkanDll) {
Write-Host "vulkan-1.dll found at: $vulkanDll"
} else {
Write-Host "WARNING: vulkan-1.dll NOT found at: $vulkanDll"
}
node -e "
const { loadBinary } = require('./lib');
const addon = loadBinary();
console.log('✓ Platform package loaded successfully');
console.log(' Exports:', Object.keys(addon));
"
env:
LLOYAL_GPU: ${{ matrix.gpu }}
LLOYAL_NO_FALLBACK: '1'
- name: Run API tests (Windows)
if: runner.os == 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
shell: pwsh
run: |
$pkgBin = "$PWD\node_modules\@lloyal-labs\lloyal.node-${{ matrix.package }}\bin"
$env:PATH = "$pkgBin;$env:PATH"
if ($env:VULKAN_SDK) { $env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH" }
npm run test:api
timeout-minutes: 5
env:
LLOYAL_GPU: ${{ matrix.gpu }}
- name: Run API tests (Unix)
if: runner.os != 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
run: |
PKG_BIN="$PWD/node_modules/@lloyal-labs/lloyal.node-${{ matrix.package }}/bin"
export LD_LIBRARY_PATH="${PKG_BIN}:${LD_LIBRARY_PATH:-}"
npm run test:api
timeout-minutes: 5
env:
LLOYAL_GPU: ${{ matrix.gpu }}
- name: Run E2E tests (Windows)
if: runner.os == 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
shell: pwsh
run: |
$pkgBin = "$PWD\node_modules\@lloyal-labs\lloyal.node-${{ matrix.package }}\bin"
$env:PATH = "$pkgBin;$env:PATH"
if ($env:VULKAN_SDK) { $env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH" }
npm run test:e2e
timeout-minutes: 5
env:
LLOYAL_GPU: ${{ matrix.gpu }}
- name: Run E2E tests (Unix)
if: runner.os != 'Windows' && matrix.cross_compile != true && matrix.gpu != 'cuda'
run: |
PKG_BIN="$PWD/node_modules/@lloyal-labs/lloyal.node-${{ matrix.package }}/bin"
export LD_LIBRARY_PATH="${PKG_BIN}:${LD_LIBRARY_PATH:-}"
npm run test:e2e
timeout-minutes: 5
env:
LLOYAL_GPU: ${{ matrix.gpu }}
# Upload artifact (for debugging)
- name: Upload platform package artifact
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.package }}
path: packages/${{ matrix.package }}/
retention-days: 7