Faster Exact Search for C, Python, and JavaScript #544
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Release | |
on: | |
push: | |
branches: ["main-dev"] | |
pull_request: | |
branches: ["main-dev"] | |
env: | |
BUILD_TYPE: Release | |
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} | |
PYTHONUTF8: 1 | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
jobs: | |
test_c: | |
name: Test C | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main-dev | |
- run: git submodule update --init --recursive | |
- name: Prepare Environment | |
run: | | |
sudo apt update && | |
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev | |
- name: Build | |
run: | | |
cmake -B ./build_release \ | |
-DCMAKE_CXX_COMPILER="g++-12" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DUSEARCH_BUILD_CTEST=1 \ | |
-DUSEARCH_USE_OPENMP=1 \ | |
-DUSEARCH_USE_SIMSIMD=1 \ | |
-DUSEARCH_USE_JEMALLOC=1 \ | |
-DUSEARCH_BUILD_BENCHMARK=0 && | |
make -C ./build_release -j | |
- name: Run tests | |
run: ./build_release/test_c | |
test_cpp: | |
name: Test C++ | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main-dev | |
- run: git submodule update --init --recursive | |
- name: Prepare Environment | |
run: | | |
sudo apt update && | |
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev | |
- name: Build | |
run: | | |
cmake -B ./build_release \ | |
-DCMAKE_CXX_COMPILER="g++-12" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DUSEARCH_BUILD_TEST=1 \ | |
-DUSEARCH_USE_OPENMP=1 \ | |
-DUSEARCH_USE_SIMSIMD=1 \ | |
-DUSEARCH_USE_JEMALLOC=1 \ | |
-DUSEARCH_BUILD_BENCHMARK=0 && | |
make -C ./build_release -j | |
- name: Run tests | |
run: ./build_release/test | |
test_python_311: | |
name: Test Python | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, macOS-11, windows-2022] | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest numpy | |
- name: Build locally on Ubuntu | |
run: | | |
export CC=/usr/bin/gcc-12 | |
export CXX=/usr/bin/g++-12 | |
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:$LD_LIBRARY_PATH | |
python -m pip install . | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
- name: Build locally | |
run: python -m pip install . | |
if: ${{ matrix.os != 'ubuntu-22.04' }} | |
- name: Test with PyTest | |
run: pytest python/scripts/ -s -x | |
test_python_37: | |
name: Test Python 3.7 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04] | |
python-version: ["3.7"] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest numpy | |
- name: Build locally | |
run: | | |
export CC=/usr/bin/gcc-12 | |
export CXX=/usr/bin/g++-12 | |
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:$LD_LIBRARY_PATH | |
python -m pip install . | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
- name: Test with PyTest | |
run: pytest python/scripts/ -s -x | |
test_javascript: | |
name: Test JavaScript | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: | | |
export CC=/usr/bin/gcc-12 | |
export CXX=/usr/bin/g++-12 | |
npm install | |
- run: npm ci | |
- run: npm test | |
test_rust: | |
name: Test Rust | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
test_java: | |
name: Test Java | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/[email protected] | |
- name: Execute Gradle build | |
run: | |
export CC=/usr/bin/gcc-12 | |
export CXX=/usr/bin/g++-12 | |
gradle clean build | |
test_swift: | |
name: Test ObjC & Swift | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Build | |
run: swift build | |
- name: Run tests | |
run: swift test | |
test_csharp: | |
name: Test C# | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
dotnet-version: ['7.0.x'] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Setup .NET ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Ubuntu/macOS build native lib | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
run: ./build_lib.sh | |
shell: bash | |
working-directory: ${{ github.workspace }}/csharp/eng/ | |
# Use cl.exe https://www.appveyor.com/docs/lang/cpp/#visual-studio-2017 | |
# There is no support for c++11 | |
- name: Windows MSVC build | |
if: matrix.os == 'windows-latest' | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
where cl | |
cl /EHsc /std:c++14 /O2 /LD /Fe:libusearch_c.dll lib.cpp /I. /I../include/ /I../fp16/include/ | |
working-directory: ${{ github.workspace }}/c | |
shell: cmd | |
- name: Windows move dll to lib dir | |
if: matrix.os == 'windows-latest' | |
run: | | |
mkdir -p "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native" | |
mv "${GITHUB_WORKSPACE}/c/libusearch_c.dll" "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native" | |
shell: bash | |
- name: Build and test | |
run: dotnet test -c Release | |
shell: bash | |
working-directory: ${{ github.workspace }}/csharp/ | |
test_golang: | |
name: Test Golang | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: 'main-dev' | |
- run: git submodule update --init --recursive | |
- name: Prepare environment | |
run: | | |
sudo apt update && | |
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev | |
- name: Build library | |
run: | | |
cd golang/ | |
export CC=/usr/bin/gcc-12 | |
export CXX=/usr/bin/g++-12 | |
make -C ../c libusearch_c.so | |
sudo mv ../c/libusearch_c.so /usr/local/lib/libusearch.a | |
sudo mv ../c/usearch.h /usr/local/include/usearch.h | |
- name: Run test | |
run: | | |
cd golang | |
go test -v | |
build_docker: | |
name: Test Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
push: false |