Skip to content

fix(ci): migrate to nvidia/cuda container, skip integration tests for… #2

fix(ci): migrate to nvidia/cuda container, skip integration tests for…

fix(ci): migrate to nvidia/cuda container, skip integration tests for… #2

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 }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
# Linux x64 GPU
- os: ubuntu-22.04
arch: x64
gpu: cuda
package: linux-x64-cuda
container: nvidia/cuda:12.6.2-devel-ubuntu22.04
- os: ubuntu-22.04
arch: x64
gpu: vulkan
package: linux-x64-vulkan
container: ''
# Linux ARM64 GPU
- os: ubuntu-22.04-arm
arch: arm64
gpu: cuda
package: linux-arm64-cuda
container: nvidia/cuda:12.6.2-devel-ubuntu22.04
- os: ubuntu-22.04-arm
arch: arm64
gpu: vulkan
package: linux-arm64-vulkan
container: ''
# Windows x64 GPU
- os: windows-2022
arch: x64
gpu: cuda
package: win32-x64-cuda
container: ''
- os: windows-2022
arch: x64
gpu: vulkan
package: win32-x64-vulkan
container: ''
# Windows ARM64 Vulkan (cross-compiled)
- os: windows-2022
arch: arm64
gpu: vulkan
package: win32-arm64-vulkan
cross_compile: true
container: ''
steps:
# CUDA container has old git - upgrade before checkout
- name: Upgrade git (CUDA container)
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
run: |
apt-get update
apt-get install -y git
- 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 (no sudo in containers, sudo for regular runners)
- name: Install build tools (Linux - container)
if: runner.os == 'Linux' && matrix.container != ''
run: |
apt-get update
apt-get install -y build-essential cmake ninja-build
- name: Install build tools (Linux - no container)
if: runner.os == 'Linux' && matrix.container == ''
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
# CUDA (skip on Linux - using nvidia/cuda container which has CUDA)
# Container already has CUDA toolkit and driver stubs
- 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"
}
# Add CUDA runtime to PATH if available
if ($env:CUDA_PATH) {
$env:PATH = "$env:CUDA_PATH\bin;$env:PATH"
Write-Host "Added CUDA bin to PATH: $env:CUDA_PATH\bin"
}
Write-Host "Package bin: $pkgBin"
Write-Host "VULKAN_SDK: $env:VULKAN_SDK"
Write-Host "CUDA_PATH: $env:CUDA_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: 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