mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 08:46:49 +02:00
251 lines
8.9 KiB
YAML
251 lines
8.9 KiB
YAML
name: "Test"
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
build-linux-x86_64-extension:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: ./scripts/vendor.sh
|
|
- run: make loadable static
|
|
- run: pip install pytest numpy; make test-loadable
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-linux-x86_64-extension
|
|
path: dist/*
|
|
build-android-extensions:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platforms:
|
|
[
|
|
{ name: android-aarch64, cc: aarch64-linux-android21-clang },
|
|
{ name: android-i686, cc: i686-linux-android21-clang },
|
|
{ name: android-x86_64, cc: x86_64-linux-android21-clang },
|
|
{ name: android-armv7a, cc: armv7a-linux-androideabi21-clang },
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: ./scripts/vendor.sh
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
java-version: "17"
|
|
distribution: "temurin"
|
|
- uses: android-actions/setup-android@v3
|
|
- run: |
|
|
sdkmanager --install "ndk;27.0.12077973"
|
|
echo "ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/27.0.12077973" >> $GITHUB_ENV
|
|
- run: |
|
|
ls $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/
|
|
ls $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
|
|
- run: |
|
|
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
|
make CC=${{ matrix.platforms.cc }} \
|
|
AR=llvm-ar \
|
|
RANLIB=llvm-ranlib \
|
|
STRIP=llvm-strip loadable
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-android-${{ matrix.platforms.name }}-extension
|
|
path: dist/*.so
|
|
build-ios-extensions:
|
|
runs-on: ${{ matrix.platforms.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platforms: [
|
|
{
|
|
name: ios-arm64,
|
|
target: arm64-apple-ios,
|
|
sdk: iphoneos,
|
|
runner: macos-14,
|
|
},
|
|
#{
|
|
# name: ios-x86_64,
|
|
# target: x86_64-apple-ios,
|
|
# sdk: iphoneos,
|
|
# runner: macos-12,
|
|
#},
|
|
{
|
|
name: ios-simulator-arm64,
|
|
target: arm64-apple-ios-simulator,
|
|
sdk: iphonesimulator,
|
|
runner: macos-14,
|
|
},
|
|
{
|
|
name: ios-simulator-x86_64,
|
|
target: x86_64-apple-ios-simulator,
|
|
sdk: iphonesimulator,
|
|
runner: macos-14,
|
|
},
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: latest-stable
|
|
- run: ./scripts/vendor.sh
|
|
|
|
- run: make CFLAGS="-target ${{ matrix.platforms.target }} -isysroot $(xcrun -sdk ${{ matrix.platforms.sdk }} --show-sdk-path) -fembed-bitcode -DNDEBUG=1" loadable static
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-${{ matrix.platforms.name }}-extension
|
|
path: dist/*
|
|
build-macos-x86_64-extension:
|
|
runs-on: macos-12
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: ./scripts/vendor.sh
|
|
- run: make loadable static
|
|
- run: /usr/local/opt/python@3/libexec/bin/python -m pip install --break-system-packages pytest numpy; make test-loadable python=/usr/local/opt/python@3/libexec/bin/python
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-macos-x86_64-extension
|
|
path: dist/*
|
|
build-macos-aarch64-extension:
|
|
runs-on: macos-14
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: ./scripts/vendor.sh
|
|
- run: make loadable static
|
|
- run: /opt/homebrew/opt/python3/libexec/bin/python -m pip install pytest numpy --break-system-packages; make test-loadable python=/opt/homebrew/opt/python3/libexec/bin/python
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-macos-aarch64-extension
|
|
path: dist/*
|
|
build-windows-x86_64-extension:
|
|
runs-on: windows-2019
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: ./scripts/vendor.sh
|
|
shell: bash
|
|
- run: make sqlite-vec.h
|
|
- run: mkdir dist
|
|
- run: cl.exe /fPIC -shared /W4 /Ivendor/ /O2 /LD sqlite-vec.c -o dist/vec0.dll
|
|
- run: pip install pytest numpy; make test-loadable
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-windows-x86_64-extension
|
|
path: dist/*
|
|
build-linux-aarch64-extension:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: green-coding-solutions/eco-ci-energy-estimation@v4
|
|
with:
|
|
task: start-measurement
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
version: "latest"
|
|
- run: sudo apt-get install gcc-arm-linux-gnueabihf
|
|
- run: ./scripts/vendor.sh
|
|
- run: make sqlite-vec.h
|
|
- run: make CC=arm-linux-gnueabihf-gcc loadable static
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-linux-aarch64-extension
|
|
path: dist/*
|
|
- uses: green-coding-solutions/eco-ci-energy-estimation@v4
|
|
with:
|
|
task: get-measurement
|
|
label: "all"
|
|
- uses: green-coding-solutions/eco-ci-energy-estimation@v4
|
|
with:
|
|
task: display-results
|
|
build-wasm32-emscripten:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: mymindstorm/setup-emsdk@v12
|
|
with:
|
|
version: "latest"
|
|
- run: ./scripts/vendor.sh
|
|
- run: make sqlite-vec.h
|
|
- run: make wasm
|
|
- run: ls; ls dist; ls dist/.wasm
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-wasm32-emscripten
|
|
path: dist/.wasm/*
|
|
include-hidden-files: true
|
|
build-pyodide:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: mymindstorm/setup-emsdk@v12
|
|
with:
|
|
version: "latest"
|
|
- run: ./scripts/vendor.sh
|
|
- run: make sqlite-vec.h
|
|
- run: |
|
|
emcc -c ./sqlite-vec.c -o ./sqlite-vec.o -I ./vendor -fPIC -g3 \
|
|
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_OMIT_POPEN=1 -DSQLITE_THREADSAFE=0
|
|
emcc ./sqlite-vec.o -o vec0.so -s SIDE_MODULE=1 -g3 -s WASM_BIGINT=1
|
|
- run: ls
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-pyodide
|
|
path: vec0.so
|
|
build-ncruces-go:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: make sqlite-vec.h
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: ncruces/go-sqlite3
|
|
path: go-sqlite3
|
|
- run: git apply ../bindings/go/ncruces/go-sqlite3.patch
|
|
working-directory: go-sqlite3/
|
|
- run: |
|
|
mkdir -p tools/
|
|
[ -d "tools/wasi-sdk" ] || curl -#L "$WASI_SDK" | tar xzC tools &
|
|
[ -d "tools/binaryen" ] || curl -#L "$BINARYEN" | tar xzC tools &
|
|
wait
|
|
|
|
mv "tools/wasi-sdk"* "tools/wasi-sdk"
|
|
mv "tools/binaryen"* "tools/binaryen"
|
|
|
|
sqlite3/download.sh
|
|
embed/build.sh
|
|
env:
|
|
WASI_SDK: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz"
|
|
BINARYEN: "https://github.com/WebAssembly/binaryen/releases/download/version_118/binaryen-version_118-x86_64-linux.tar.gz"
|
|
working-directory: go-sqlite3/
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-ncruces-go
|
|
path: go-sqlite3/embed/sqlite3.wasm
|
|
build-cosmopolitan:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: |
|
|
mkdir $HOME/cosmo
|
|
curl -L -o cosmocc-$COSMO_VERSION.zip https://github.com/jart/cosmopolitan/releases/download/$COSMO_VERSION/cosmocc-$COSMO_VERSION.zip
|
|
unzip cosmocc-$COSMO_VERSION.zip -d $HOME/cosmo
|
|
env:
|
|
COSMO_VERSION: "3.5.4"
|
|
- run: ./scripts/vendor.sh
|
|
- run: make cli CC=$HOME/cosmo/bin/cosmocc AR=$HOME/cosmo/bin/cosmoar OMIT_SIMD=1
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlite-vec-cosmopolitan
|
|
path: dist/*
|
|
test-minimum:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: make sqlite-vec.h
|
|
- run: make test
|
|
working-directory: tests/minimum
|