-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (166 loc) · 6.13 KB
/
tests.yml
File metadata and controls
200 lines (166 loc) · 6.13 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Build & Test
on:
pull_request:
branches: [ main ]
jobs:
test-build:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache test models
uses: actions/cache@v4
with:
path: models/
key: test-models-v1-${{ hashFiles('test/matrix.json') }}
- name: Download test models
run: bash scripts/download-test-models.sh
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Install build dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cmake
- name: Install build dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
# MSVC already available on GitHub runners
- name: Verify submodules exist
run: |
node -e "const fs = require('fs'); if (!fs.existsSync('llama.cpp/CMakeLists.txt')) throw new Error('llama.cpp submodule missing! Run: git submodule update --init --recursive'); console.log('✓ Submodules found');"
- name: Validate llama.cpp version
run: node scripts/sync-llama-cpp.js --check
shell: bash
- name: Install npm dependencies
run: npm install --ignore-scripts
- name: Build from submodules
run: npm run build
env:
# Force CPU — GitHub Actions paravirtual Metal GPU has driver bugs
LLOYAL_GPU: cpu
# This runs scripts/build.js which:
# 1. Builds llama.cpp from llama.cpp/
# 2. Builds liblloyal from liblloyal/
# 3. Builds N-API addon with cmake-js
- name: Verify build outputs
run: |
node -e "const fs = require('fs'); const files = fs.readdirSync('build/Release'); console.log('Build outputs:', files); if (!files.some(f => f.endsWith('.node'))) throw new Error('No .node file built!');"
- name: Run integration tests (Windows)
if: runner.os == 'Windows'
run: |
$env:PATH = "${{ github.workspace }}\build\Release;$env:PATH"
npm run test:integration
timeout-minutes: 10
env:
LLOYAL_LOCAL: '1'
- name: Run integration tests (Unix)
if: runner.os != 'Windows'
run: npm run test:integration
timeout-minutes: 10
env:
LLOYAL_LOCAL: '1'
- name: Display build info
if: always()
run: |
echo "================================"
echo "Build Information"
echo "================================"
echo "OS: ${{ runner.os }}"
echo "Node: 24"
echo "Platform: $(node -p 'process.platform')"
echo "Arch: $(node -p 'process.arch')"
echo "Build system: cmake-js"
echo "llama.cpp: $(cd llama.cpp && git rev-parse --short HEAD)"
echo "liblloyal: $(cd liblloyal && git rev-parse --short HEAD)"
shell: bash
- name: Upload build artifacts (failures only)
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-failure-${{ matrix.os }}
path: |
build/
build/CMakeCache.txt
build/CMakeFiles/CMakeError.log
retention-days: 7
verify-npm-package:
name: Verify npm package contents
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# No submodules needed - npm package doesn't include sources
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build TypeScript
run: npm run build:ts
- name: Pack package
run: npm pack
- name: Extract and verify tarball
run: |
tar -tzf lloyal-labs-lloyal.node-*.tgz > package-contents.txt
echo "📦 Package contents:"
cat package-contents.txt
# Verify dist/ JavaScript is included
if ! grep -q "package/dist/index.js" package-contents.txt; then
echo "❌ ERROR: dist/index.js not in package!"
exit 1
fi
# Verify submodules are NOT included (they're huge)
if grep -q "package/llama.cpp/" package-contents.txt; then
echo "❌ ERROR: llama.cpp/ should not be in package!"
exit 1
fi
if grep -q "package/liblloyal/" package-contents.txt; then
echo "❌ ERROR: liblloyal/ should not be in package!"
exit 1
fi
# Verify build artifacts are NOT included
if grep -q "package/build/" package-contents.txt; then
echo "❌ ERROR: build/ should not be in package!"
exit 1
fi
echo "✅ Package contents verified!"
- name: Upload package for inspection
uses: actions/upload-artifact@v4
with:
name: npm-package
path: lloyal-labs-lloyal.node-*.tgz
retention-days: 7
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-build, verify-npm-package]
if: always()
steps:
- name: Check test results
run: |
echo "================================"
echo "Test Results Summary"
echo "================================"
echo "✓ Source builds tested on Linux, macOS, and Windows"
echo "✓ Node.js 24 (Active LTS) compatibility verified"
echo "✓ npm package contents verified"
echo "✓ Integration tests passed"
echo "✓ Model matrix tested on GPU (gpu-test.yml)"
echo ""
echo "Build & Test Status: ${{ needs.test-build.result }}"