-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (116 loc) · 4 KB
/
gpu-test.yml
File metadata and controls
139 lines (116 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: GPU Tests (CUDA)
on:
pull_request:
branches: [ main ]
paths:
- 'liblloyal'
- 'llama.cpp'
- 'src/**'
- 'test/**'
- 'CMakeLists.txt'
workflow_dispatch:
workflow_call:
inputs:
skip_build:
description: 'Skip build step (packages already built by caller)'
type: boolean
default: true
jobs:
build-cuda-package:
name: Build linux-x64-cuda
if: ${{ github.repository == 'lloyal-ai/lloyal.node' && inputs.skip_build != true }}
runs-on: ubuntu-22.04
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'
- name: Validate llama.cpp version
run: node scripts/sync-llama-cpp.js --check
shell: bash
# CUDA 12.2.2 required for Cloud Run L4 GPU (driver 535.x)
# provision-cuda also installs build-essential + cmake
- name: Provision CUDA toolkit
uses: ./.github/actions/provision-cuda
with:
version: '12.2.2'
arch: x64
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: cuda-build-${{ runner.os }}
- name: Install npm dependencies
run: npm install --ignore-scripts
- name: Build native module
run: npm run build
env:
LLOYAL_GPU: cuda
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CMAKE_CUDA_COMPILER_LAUNCHER: ccache
- name: Create platform package
run: node scripts/create-platform-package.js linux-x64-cuda ubuntu-22.04 x64
- name: Upload platform package artifact
uses: actions/upload-artifact@v4
with:
name: package-linux-x64-cuda
path: packages/linux-x64-cuda/
retention-days: 1
compression-level: 0
gpu-integration:
name: GPU Tests (L4)
needs: build-cuda-package
runs-on: ubuntu-latest
if: ${{ github.repository == 'lloyal-ai/lloyal.node' && !cancelled() && (needs.build-cuda-package.result == 'success' || needs.build-cuda-package.result == 'skipped') }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout infrastructure scripts
uses: actions/checkout@v4
with:
repository: lloyal-ai/lloyal-infra
token: ${{ secrets.INFRA_REPO_PAT }}
path: ci
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WIF_PROVIDER }}
service_account: ${{ secrets.GCP_SA_EMAIL }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Configure Docker for Artifact Registry
run: gcloud auth configure-docker ${{ secrets.GCP_REGION }}-docker.pkg.dev --quiet
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Compile TypeScript (src + tests)
run: |
npm ci --ignore-scripts
npm run build:ts
npm run build:test
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: package-linux-x64-cuda
path: packages/package-linux-x64-cuda
- name: Build and push GPU test image
run: |
IMAGE="${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_AR_REPO }}/gpu-tests:${{ github.sha }}-cuda"
docker build -f ci/Dockerfile.gpu-tests -t "$IMAGE" .
docker push "$IMAGE"
echo "IMAGE=$IMAGE" >> $GITHUB_ENV
- name: Deploy and run GPU tests
run: bash ci/deploy-gpu-tests.sh
env:
GCP_REGION: ${{ secrets.GCP_REGION }}
GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }}