Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
87cd26a
Update .gitignore, add main.yml workflow, and create Makefile for SQL…
Gioee Jul 8, 2025
51ab3ba
Enable submodule checkout in GitHub Actions workflow
Gioee Jul 8, 2025
0e86213
Update Makefile to use available CPU cores for building libraries
Gioee Jul 8, 2025
6fa5eb3
Update Makefile for macOS fat library support
Gioee Jul 8, 2025
837c482
Update Makefile for improved macOS, iOS and iSIM support
Gioee Jul 8, 2025
cf78a12
Enable BLAS support for Linux platform in Makefile
Gioee Jul 8, 2025
2e4be01
Update Makefile to remove unnecessary ggml-blas references and ensure…
Gioee Jul 8, 2025
1413190
Update Makefile to enhance library linking and deployment targets for…
Gioee Jul 8, 2025
0bf7e25
Update Makefile to improve library linking for LLAMA and WHISPER, and…
Gioee Jul 8, 2025
346c7c1
Fix Makefile build submodules on Windows
Gioee Jul 8, 2025
6b72907
Update Makefile to enable position-independent code for LLAMA and WHI…
Gioee Jul 8, 2025
0439ecf
Fix test command in Makefile to load the correct AI module from the d…
Gioee Jul 8, 2025
2c5eb69
Update Makefile for Android platform to include toolchain and archite…
Gioee Jul 8, 2025
b8fa193
Update Makefile for Android platform to adjust architecture-specific …
Gioee Jul 8, 2025
f0e0c59
Update Makefile and GitHub Actions workflow for Windows compatibility
Gioee Jul 8, 2025
ebdbacb
Update Makefile for Android platform to adjust architecture-specific …
Gioee Jul 8, 2025
4ada3fb
Add separate build step for Windows in GitHub Actions workflow
Gioee Jul 8, 2025
9d4bcd6
Add CMake installation for Windows build in GitHub Actions workflow
Gioee Jul 8, 2025
6dbfe2f
Update Makefile to enable Vulkan and OpenMP for Linux builds
Gioee Jul 8, 2025
e45515b
Remove Vulkan option from Linux build in Makefile
Gioee Jul 8, 2025
24f4d01
Remove OpenSSL folder cleanup from Android build process
Gioee Jul 8, 2025
68c1bef
Enable CoreML support in macOS and iOS builds in Makefile
Gioee Jul 8, 2025
add42b2
Cleanup unused folders in Android test process to save space and avoi…
Gioee Jul 8, 2025
a6adb84
Update Makefile to enable static linking for Android builds and add d…
Gioee Jul 8, 2025
ac17185
Add stripping of debug symbols for platform-specific builds in Makefile
Gioee Jul 8, 2025
2948628
Update GitHub Actions workflow to include Vulkan installation for Lin…
Gioee Jul 9, 2025
6733444
feat(linux): safe resource free up
Jul 14, 2025
048463a
fix(windows): missing git
Jul 15, 2025
b32c573
fix(windows): missing codecvt link
Jul 15, 2025
b5fdbe4
chore(windows): detecting fix for make test
Jul 15, 2025
fd2db0e
chore(worflow): readability
Jul 15, 2025
d1f03d6
feat(miniaudio): build along the other modules
Jul 15, 2025
3b909a6
chore(workflow): remove dependency
Jul 15, 2025
7c0a583
fix(makefile): compile extension before modules
Jul 16, 2025
837e54a
fix(makefile); missing ios framworks
Jul 16, 2025
f8b3b00
fix(makefile): build before submodules but not trigger rebuild
Jul 16, 2025
13c389a
fix(makefile): variables declaration before usage
Jul 17, 2025
9a466f1
fix(makefile): identation to tabs
Jul 17, 2025
a049445
fix(windows): use GetSystemTimeAsFileTime for timestamp
Jul 17, 2025
3c3b300
feat(makefile): miniaudio built for android
Jul 17, 2025
82e79e9
feat(ios): restore workflows for iOS builds
Jul 17, 2025
08d53d7
feat(windows-cuda): make CUDA for Windows
Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
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: windows-cuda
os: windows-latest
arch: x86_64
make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU=OFF -DGGML_CUDA=ON"
# - 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/[email protected]
with:
submodules: true

- 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: Install CUDA Toolkit
if: matrix.name == 'windows-cuda'
run: |
choco install cuda -y --no-progress
shell: powershell

- name: Setup MSBuild
if: matrix.name == 'windows' || matrix.name == 'windows-cuda'
uses: microsoft/setup-msbuild@v2

- name: Windows build sqlite-ai
if: matrix.name == 'windows' || matrix.name == 'windows-cuda'
shell: cmd
run: |
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat"
nmake /f Makefile PLATFORM=windows ${{ matrix.make && matrix.make || ''}}

- 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/[email protected]
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.os == 'windows-latest'
run: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake /f Makefile test PLATFORM=windows
shell: cmd

- name: test sqlite-ai
if: matrix.name == 'linux' || matrix.name == 'macos'
run: make test

- uses: actions/[email protected]
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/[email protected]

- uses: actions/[email protected]
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/[email protected]
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
.DS_Store
/modules/libs
*.xcworkspacedata
*.xcuserstate
*.xcbkptlist
*.plist
/build
/dist
*.sqlite
*.a
.vscode
Loading
Loading