-
Notifications
You must be signed in to change notification settings - Fork 13
248 lines (219 loc) · 9.51 KB
/
main.yml
File metadata and controls
248 lines (219 loc) · 9.51 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: build, test and release sqlite-ai
on:
push:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'isim' && matrix.name != 'ios' && ' + test' || ''}}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
# - name: linux-vulkan
# os: ubuntu-latest
# arch: x86_64
# make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON"
- name: macos
os: macos-latest
# - name: windows
# os: windows-latest
# arch: x86_64
# - name: android
# os: ubuntu-latest
# arch: arm64-v8a
# make: PLATFORM=android ARCH=arm64-v8a
# - name: android
# os: ubuntu-latest
# arch: x86_64
# make: PLATFORM=android ARCH=x86_64
# sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
# - name: ios
# os: macos-latest
# make: PLATFORM=ios
# - name: isim
# os: macos-latest
# make: PLATFORM=isim
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4.2.2
with:
submodules: true
- uses: msys2/setup-msys2@v2.27.0
if: matrix.os == 'windows-latest'
with:
msystem: mingw64
install: >-
mingw-w64-x86_64-cc
mingw-w64-x86_64-cmake
make
- name: linux install dependencies
if: matrix.name == 'linux-vulkan'
run: |
sudo apt-get update -y
sudo apt-get install -y build-essential wget git cmake sqlite3 libcurl4-openssl-dev
- name: linux install vulkan
if: matrix.name == 'linux-vulkan'
run: |
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
sudo apt-get update -y
sudo apt-get install -y mesa-vulkan-drivers
# Vulkan is no longer packed for Ubuntu
wget https://sdk.lunarg.com/sdk/download/latest/linux/vulkan-sdk.tar.xz?Human=true -O vulkan-sdk.tar.xz
tar -xf vulkan-sdk.tar.xz
cd $(ls -d 1.* | head -n1)
source setup-env.sh
echo "VULKAN_SDK=$VULKAN_SDK" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "VK_ADD_LAYER_PATH=$VK_ADD_LAYER_PATH" >> $GITHUB_ENV
- name: windows install dependencies
if: matrix.os == 'windows-latest'
run: |
pacman -S --noconfirm git sqlite3
shell: msys2 {0}
- name: windows build sqlite-ai
if: matrix.name == 'windows'
run: make extension ${{ matrix.make && matrix.make || ''}}
shell: msys2 {0}
- name: build sqlite-ai
if: matrix.name != 'windows'
run: make extension ${{ matrix.make && matrix.make || ''}}
- name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION
if: matrix.name == 'macos'
run: brew link sqlite --force
- name: android setup test environment
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
run: |
echo "::group::enable kvm group perms"
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
echo "::endgroup::"
echo "::group::download and build sqlite3 without SQLITE_OMIT_LOAD_EXTENSION"
curl -O ${{ matrix.sqlite-amalgamation-zip }}
unzip sqlite-amalgamation-*.zip
export ${{ matrix.make }}
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.arch }}-linux-android26-clang sqlite-amalgamation-*/shell.c sqlite-amalgamation-*/sqlite3.c -o sqlite3 -ldl
# remove unused folders to save up space
rm -rf sqlite-amalgamation-*.zip sqlite-amalgamation-*
echo "::endgroup::"
echo "::group::prepare the test script"
make test PLATFORM=$PLATFORM ARCH=$ARCH || echo "It should fail. Running remaining commands in the emulator"
cat > commands.sh << EOF
mv -f /data/local/tmp/sqlite3 /system/xbin
cd /data/local/tmp
$(make test PLATFORM=$PLATFORM ARCH=$ARCH -n)
EOF
# remove big unused folders to avoid emulator errors
rm -rf build modules
echo "::endgroup::"
- name: android test sqlite-ai
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
uses: reactivecircus/android-emulator-runner@v2.34.0
with:
api-level: 26
arch: ${{ matrix.arch }}
script: |
adb root
adb remount
adb push ${{ github.workspace }}/. /data/local/tmp/
adb shell "sh /data/local/tmp/commands.sh"
- name: windows test sqlite-ai
if: matrix.name == 'windows'
run: make test
shell: msys2 {0}
- name: check whisper CoreML linking (macOS)
if: matrix.name == 'macos'
run: |
echo "Checking if whisper CoreML symbols are present..."
echo "=== Dynamic symbols in ai.dylib ==="
nm -D dist/ai.dylib | grep -i coreml || echo "CoreML symbols not found in dynamic symbol table"
echo "=== All symbols in ai.dylib ==="
nm dist/ai.dylib | grep -i coreml || echo "CoreML symbols not found in symbol table"
echo "=== Linked frameworks ==="
otool -L dist/ai.dylib | grep CoreML || echo "CoreML framework not linked"
echo "=== CoreML symbols in whisper libraries ==="
nm build/whisper.cpp/src/libwhisper.a | grep coreml || echo "No CoreML symbols in libwhisper.a"
nm build/whisper.cpp/src/libwhisper.coreml.a | grep coreml || echo "No CoreML symbols in libwhisper.coreml.a"
- name: test sqlite-ai with crash debugging (macOS)
if: matrix.name == 'macos'
run: |
echo "=== Testing with crash debugging ==="
# Enable core dumps
ulimit -c unlimited
# Run with detailed crash info
echo "Running test with lldb to capture crash info..."
echo "run" | lldb -- sqlite3 ":memory:" -cmd ".bail on" ".load ./dist/ai" "SELECT ai_version();" || {
echo "Test failed, checking for core dump..."
if [ -f core.* ]; then
echo "Core dump found, analyzing..."
echo "bt" | lldb -c core.* sqlite3
fi
# Also try with crash reporter
echo "Checking system crash logs..."
log show --predicate 'eventMessage contains "sqlite3"' --info --last 1m || true
}
# Also try running the test directly to see if it works
echo "=== Direct test run ==="
sqlite3 ":memory:" -cmd ".bail on" ".load ./dist/ai" "SELECT ai_version();" || echo "Direct test also failed"
- name: test sqlite-ai
if: matrix.name == 'linux' || matrix.name == 'macos'
run: make test
- uses: actions/upload-artifact@v4.6.2
if: always()
with:
name: ai-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
path: dist/ai.*
if-no-files-found: error
release:
runs-on: ubuntu-latest
name: release
needs: build
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/download-artifact@v4.2.1
with:
path: artifacts
- name: release tag version from sqlite-ai.h
id: tag
run: |
VERSION=$(make version)
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "::warning file=src/sqlite-ai.h::To release a new version, please update the SQLITE_AI_VERSION in src/sqlite-ai.h to be different than the latest $LATEST"
fi
exit 0
fi
echo "❌ SQLITE_AI_VERSION not found in sqlite-ai.h"
exit 1
- name: zip artifacts
run: |
for folder in "artifacts"/*; do
if [ -d "$folder" ]; then
name=$(basename "$folder")
zip -jq "${name}-${{ steps.tag.outputs.version }}.zip" "$folder"/*
tar -cJf "${name}-${{ steps.tag.outputs.version }}.tar.xz" -C "$folder" .
tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" .
fi
done
- uses: softprops/action-gh-release@v2.2.1
if: steps.tag.outputs.version != ''
with:
generate_release_notes: true
tag_name: ${{ steps.tag.outputs.version }}
files: |
ai-*-${{ steps.tag.outputs.version }}.zip
ai-*-${{ steps.tag.outputs.version }}.tar.xz
ai-*-${{ steps.tag.outputs.version }}.tar.gz
make_latest: true