usearch 2.7.7 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.dockerignore +93 -0
  2. package/.github/workflows/Dockerfile.libs +6 -2
  3. package/.github/workflows/prerelease.yml +242 -245
  4. package/.github/workflows/release.yml +390 -356
  5. package/.gitignore +1 -0
  6. package/.vscode/settings.json +3 -1
  7. package/CITATION.cff +1 -1
  8. package/CMakeLists.txt +35 -5
  9. package/Cargo.toml +1 -1
  10. package/README.md +1 -1
  11. package/build.gradle +6 -0
  12. package/c/README.md +3 -3
  13. package/c/lib.cpp +75 -11
  14. package/c/usearch.h +22 -1
  15. package/conanfile.py +1 -1
  16. package/cpp/README.md +2 -1
  17. package/cpp/bench.cpp +3 -0
  18. package/cpp/test.cpp +12 -12
  19. package/csharp/nuget/nuget-package.props +1 -1
  20. package/docs/compilation.md +5 -13
  21. package/golang/lib.go +4 -1
  22. package/include/usearch/index.hpp +31 -30
  23. package/include/usearch/index_dense.hpp +49 -48
  24. package/include/usearch/index_plugins.hpp +70 -8
  25. package/java/cloud/unum/usearch/Index.java +118 -26
  26. package/java/cloud/unum/usearch/cloud_unum_usearch_Index.cpp +8 -8
  27. package/javascript/usearch.js +1 -0
  28. package/objc/USearchObjective.mm +4 -1
  29. package/objc/include/USearchObjective.h +1 -0
  30. package/package.json +1 -1
  31. package/python/lib.cpp +3 -2
  32. package/python/scripts/bench.ipynb +24 -2
  33. package/python/usearch/index.py +8 -3
  34. package/rust/lib.cpp +14 -12
  35. package/rust/lib.hpp +13 -13
  36. package/rust/lib.rs +46 -0
  37. package/setup.py +15 -3
  38. package/simsimd/.github/workflows/prerelease.yml +7 -8
  39. package/simsimd/.github/workflows/release.yml +18 -20
  40. package/simsimd/README.md +13 -8
  41. package/simsimd/binding.gyp +1 -1
  42. package/simsimd/cpp/bench.cxx +17 -3
  43. package/simsimd/include/simsimd/binary.h +1 -3
  44. package/simsimd/include/simsimd/probability.h +234 -361
  45. package/simsimd/include/simsimd/simsimd.h +95 -65
  46. package/simsimd/include/simsimd/spatial.h +0 -3
  47. package/simsimd/include/simsimd/types.h +12 -7
  48. package/simsimd/javascript/test.js +23 -5
  49. package/simsimd/package.json +2 -2
  50. package/wasmer.toml +1 -1
  51. package/wolfram/lib.cpp +1 -1
  52. package/csharp/eng/build_lib.sh +0 -65
  53. package/csharp/eng/clean.sh +0 -12
@@ -17,22 +17,20 @@ permissions:
17
17
  packages: write
18
18
 
19
19
  jobs:
20
-
21
20
  versioning:
22
21
  name: Semantic Release
23
- runs-on: ubuntu-latest
22
+ runs-on: ubuntu-22.04
24
23
  steps:
25
- - uses: actions/checkout@v3
26
- with:
27
- persist-credentials: false
28
- - uses: actions/setup-node@v3
29
- - run: npm install --save-dev @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx semantic-release
30
-
24
+ - uses: actions/checkout@v3
25
+ with:
26
+ persist-credentials: false
27
+ - uses: actions/setup-node@v3
28
+ - run: npm install --save-dev @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx semantic-release
31
29
 
32
30
  rebase:
33
31
  name: Rebase Dev. Branch
34
32
  needs: versioning
35
- runs-on: ubuntu-latest
33
+ runs-on: ubuntu-22.04
36
34
  steps:
37
35
  - name: Checkout the latest code
38
36
  uses: actions/checkout@v3
@@ -44,7 +42,7 @@ jobs:
44
42
  git fetch origin main
45
43
  git checkout main-dev
46
44
  git rebase origin/main
47
-
45
+
48
46
  - name: Push changes
49
47
  uses: CasperWA/push-protected@v2
50
48
  with:
@@ -53,148 +51,145 @@ jobs:
53
51
  unprotect_reviews: True
54
52
  force: True
55
53
 
56
-
57
54
  create_linux_deb_package:
58
55
  name: Create Debian Package for ${{ matrix.arch }}
59
- runs-on: ubuntu-latest
56
+ runs-on: ubuntu-22.04
60
57
  needs: versioning
61
58
  strategy:
62
59
  matrix:
63
60
  arch: ["linux/amd64", "linux/arm64"]
64
61
  steps:
65
- - uses: actions/checkout@v3
66
- with:
67
- persist-credentials: false
68
- ref: 'main'
69
- - run: git submodule update --init --recursive
70
-
71
- - name: Setup QEMU
72
- uses: docker/setup-qemu-action@v2
73
-
74
- - name: Setup Docker
75
- uses: docker/setup-buildx-action@v2
76
-
77
- - name: Get Docker daemon IP
78
- id: dockerip
79
- run: |
80
- docker_ip=$(ip addr show docker0 | grep -Po 'inet \K[\d.]+') && \
81
- echo "docker_ip=$docker_ip" >> "$GITHUB_OUTPUT"
82
-
83
- - name: Set runner user password
84
- id: userpass
85
- run: |
86
- user_pass="1122"
87
- echo "runner:$user_pass" | sudo chpasswd
88
- echo "user_pass=$user_pass" >> "$GITHUB_OUTPUT"
89
-
90
- - name: Build library
91
- run: |
92
- docker buildx create --use
93
- docker buildx build \
94
- --platform ${{ matrix.arch }} \
95
- --build-arg docker_ip=${{ steps.dockerip.outputs.docker_ip }} \
96
- --build-arg user_pass=${{ steps.userpass.outputs.user_pass }} \
97
- --file .github/workflows/Dockerfile.libs \
98
- --tag unum/usearch-library:latest \
99
- --load .
100
- - name: Clear Docker buildx cache
101
- run: docker buildx prune --all --force
102
-
103
- - name: Upload archive
104
- uses: xresloader/upload-to-github-release@v1
105
- env:
106
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107
- with:
108
- file: "*.deb"
109
- update_latest_release: true
62
+ - uses: actions/checkout@v3
63
+ with:
64
+ persist-credentials: false
65
+ ref: "main"
66
+ - run: git submodule update --init --recursive
110
67
 
68
+ - name: Setup QEMU
69
+ uses: docker/setup-qemu-action@v2
70
+
71
+ - name: Setup Docker
72
+ uses: docker/setup-buildx-action@v2
73
+
74
+ - name: Get Docker daemon IP
75
+ id: dockerip
76
+ run: |
77
+ docker_ip=$(ip addr show docker0 | grep -Po 'inet \K[\d.]+') && \
78
+ echo "docker_ip=$docker_ip" >> "$GITHUB_OUTPUT"
79
+
80
+ - name: Set runner user password
81
+ id: userpass
82
+ run: |
83
+ user_pass="1122"
84
+ echo "runner:$user_pass" | sudo chpasswd
85
+ echo "user_pass=$user_pass" >> "$GITHUB_OUTPUT"
86
+
87
+ - name: Build library
88
+ run: |
89
+ docker buildx create --use
90
+ docker buildx build \
91
+ --platform ${{ matrix.arch }} \
92
+ --build-arg docker_ip=${{ steps.dockerip.outputs.docker_ip }} \
93
+ --build-arg user_pass=${{ steps.userpass.outputs.user_pass }} \
94
+ --file .github/workflows/Dockerfile.libs \
95
+ --tag unum/usearch-library:latest \
96
+ --load .
97
+ - name: Clear Docker buildx cache
98
+ run: docker buildx prune --all --force
99
+
100
+ - name: Upload archive
101
+ uses: xresloader/upload-to-github-release@v1
102
+ env:
103
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104
+ with:
105
+ file: "*.deb"
106
+ update_latest_release: true
111
107
 
112
108
  create_windows_dll_library:
113
109
  name: Create Dll Library for Windows ${{ matrix.arch }}
114
- runs-on: windows-latest
110
+ runs-on: windows-2022
115
111
  needs: versioning
116
112
  strategy:
117
113
  matrix:
118
114
  arch: [x64, x86]
119
115
  steps:
120
- - uses: actions/checkout@v3
121
- with:
122
- persist-credentials: false
123
- ref: 'main'
124
- - run: git submodule update --init --recursive
125
-
126
- - name: Setup Cmake
127
- uses: jwlawson/actions-setup-cmake@v1.13
128
-
129
- - uses: actions/setup-go@v4
130
- with:
131
- go-version: '^1.19.0'
132
-
133
- - name: Setup MinGW
134
- uses: egor-tensin/setup-mingw@v2
135
- with:
136
- platform: ${{ matrix.arch }}
137
-
138
- - name: Get version
139
- id: set_version
140
- shell: bash
141
- run: |
142
- version=$(cat VERSION)
143
- echo "version=$version" >> $GITHUB_OUTPUT
144
-
145
- - name: Build library
146
- run: |
147
- cd c
148
- make libusearch_c.dll
149
- tar -cvf usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar .\libusearch_c.dll .\usearch.h
150
-
151
- - name: Upload archive
152
- uses: xresloader/upload-to-github-release@v1
153
- env:
154
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155
- with:
156
- file: "c/usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar"
157
- update_latest_release: true
116
+ - uses: actions/checkout@v3
117
+ with:
118
+ persist-credentials: false
119
+ ref: "main"
120
+ - run: git submodule update --init --recursive
121
+
122
+ - name: Setup CMake
123
+ uses: jwlawson/actions-setup-cmake@v1.13
158
124
 
125
+ - uses: actions/setup-go@v4
126
+ with:
127
+ go-version: "^1.19.0"
128
+
129
+ - name: Setup MinGW
130
+ uses: egor-tensin/setup-mingw@v2
131
+ with:
132
+ platform: ${{ matrix.arch }}
133
+ version: 12.2.0
134
+
135
+ - name: Get version
136
+ id: set_version
137
+ shell: bash
138
+ run: |
139
+ version=$(cat VERSION)
140
+ echo "version=$version" >> $GITHUB_OUTPUT
141
+
142
+ - name: Build library
143
+ run: |
144
+ cmake -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_BENCH_CPP=0 -B ./build_release
145
+ cmake --build ./build_release --config Release
146
+ tar -cvf usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar .\build_release\libusearch_c.dll .\c\usearch.h
147
+
148
+ - name: Upload archive
149
+ uses: xresloader/upload-to-github-release@v1
150
+ env:
151
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152
+ with:
153
+ file: "usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar"
154
+ update_latest_release: true
159
155
 
160
156
  create_macos_library:
161
157
  name: Create Library for MacOS ${{ matrix.arch }}
162
- runs-on: macOS-latest
158
+ runs-on: macos-12
163
159
  needs: versioning
164
160
  strategy:
165
161
  matrix:
166
162
  arch: [arm64, x86_64]
167
163
  steps:
168
- - uses: actions/checkout@v3
169
- with:
170
- persist-credentials: false
171
- ref: 'main'
172
- - run: git submodule update --init --recursive
173
-
174
- - uses: actions/setup-go@v4
175
- with:
176
- go-version: '^1.21.0'
177
-
178
- - name: Get version
179
- id: version
180
- run: |
181
- version=$(cat VERSION)
182
- echo "version=$version" >> $GITHUB_OUTPUT
183
-
184
- - name: Build library
185
- run: |
186
- cd c
187
- make libusearch_c.so -target ${{ matrix.arch }}-apple-macos11
188
- zip -r usearch_macOS_${{ matrix.arch }}_${{ steps.version.outputs.version }}.zip libusearch_c.so usearch.h
189
-
190
- - name: Upload archive
191
- uses: xresloader/upload-to-github-release@v1
192
- env:
193
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194
- with:
195
- file: "c/*.zip"
196
- update_latest_release: true
164
+ - uses: actions/checkout@v3
165
+ with:
166
+ persist-credentials: false
167
+ ref: "main"
168
+ - run: git submodule update --init --recursive
169
+
170
+ - uses: actions/setup-go@v4
171
+ with:
172
+ go-version: "^1.21.0"
173
+
174
+ - name: Get version
175
+ id: version
176
+ run: |
177
+ version=$(cat VERSION)
178
+ echo "version=$version" >> $GITHUB_OUTPUT
179
+
180
+ - name: Build library
181
+ run: |
182
+ cmake -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_BENCH_CPP=0 -B ./build_release
183
+ cmake --build ./build_release --config Release
184
+ zip -r usearch_macOS_${{ matrix.arch }}_${{ steps.version.outputs.version }}.zip build_release/libusearch_c.so c/usearch.h
197
185
 
186
+ - name: Upload archive
187
+ uses: xresloader/upload-to-github-release@v1
188
+ env:
189
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190
+ with:
191
+ file: "*.zip"
192
+ update_latest_release: true
198
193
 
199
194
  wasm_c_library:
200
195
  name: WASM builds for C libraries on ${{ matrix.os }}
@@ -204,124 +199,131 @@ jobs:
204
199
  matrix:
205
200
  os: [ubuntu-22.04, macOS-11, windows-2022]
206
201
  steps:
207
- - uses: actions/checkout@v3
208
- with:
209
- persist-credentials: false
210
- ref: 'main'
211
- - run: git submodule update --init --recursive
212
-
213
- - name: Get version
214
- id: version
215
- run: |
216
- version=$(cat VERSION)
217
- echo "version=$version" >> $GITHUB_OUTPUT
218
- shell: bash
219
-
220
- - name: Build library on Ubuntu
221
- run: |
222
- export WASI_VERSION=20
223
- export WASI_VERSION_FULL=${WASI_VERSION}.0
224
- wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
225
- tar xf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
226
- rm -rf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
227
- export WASI_SDK_PATH=/home/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
228
- archs=("x86_64" "arm64")
229
- cd ./c
230
- for arch in "${archs[@]}"
231
- do
232
- ../wasi-sdk-20.0/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
233
- tar -czvf usearch_wasm_linux_"$arch"_${{ steps.version.outputs.version }}.tar.gz libusearch_c.so
234
- mv usearch_wasm_linux_"$arch"_${{ steps.version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
235
- done
236
- if: matrix.os == 'ubuntu-22.04'
237
-
238
- - name: Build library on MacOS
239
- run: |
240
- export WASI_VERSION=20
241
- export WASI_VERSION_FULL=${WASI_VERSION}.0
242
- wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
243
- tar xf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
244
- rm -rf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
245
- export WASI_SDK_PATH=/Users/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
246
- archs=("x86_64" "arm64")
247
- cd ./c
248
- for arch in "${archs[@]}"
249
- do
250
- ../wasi-sdk-20.0/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
251
- zip -r usearch_wasm_macos_"$arch"_${{ steps.version.outputs.version }}.zip libusearch_c.so
252
- mv usearch_wasm_macos_"$arch"_${{ steps.version.outputs.version }}.zip ../ && rm -rf libusearch_c.so
253
- done
254
- if: matrix.os == 'macOS-11'
255
-
256
- - name: Build library on Windows
257
- run: |
258
- export WASI_VERSION=20
259
- export WASI_VERSION_FULL=${WASI_VERSION}.0
260
- curl -LOJ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
261
- tar xf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
262
- rm -rf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
263
- export WASI_SDK_PATH=/d/a/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}+m
264
- archs=("x64" "x86")
265
- cd ./c
266
- for arch in "${archs[@]}"
267
- do
268
- ../wasi-sdk-20.0+m/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
269
- tar -cvf usearch_wasm_windows_"$arch"_${{ steps.version.outputs.version }}.tar.gz libusearch_c.so
270
- mv usearch_wasm_windows_"$arch"_${{ steps.version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
271
- done
272
- shell: bash
273
- if: matrix.os == 'windows-2022'
274
-
275
- - name: Upload archive
276
- uses: xresloader/upload-to-github-release@v1
277
- env:
278
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
279
- with:
280
- file: "*.zip;*.tar.gz"
281
- update_latest_release: true
282
-
202
+ - uses: actions/checkout@v3
203
+ with:
204
+ persist-credentials: false
205
+ ref: "main"
206
+ - run: git submodule update --init --recursive
207
+
208
+ - name: Get version
209
+ id: version
210
+ run: |
211
+ version=$(cat VERSION)
212
+ echo "version=$version" >> $GITHUB_OUTPUT
213
+ shell: bash
214
+
215
+ - name: Build library on Ubuntu
216
+ run: |
217
+ export WASI_VERSION=20
218
+ export WASI_VERSION_FULL=${WASI_VERSION}.0
219
+ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
220
+ tar xf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
221
+ rm -rf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
222
+ export WASI_SDK_PATH=/home/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
223
+ archs=("x86_64" "arm64")
224
+ cd ./c
225
+ for arch in "${archs[@]}"
226
+ do
227
+ ../wasi-sdk-20.0/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
228
+ tar -czvf usearch_wasm_linux_"$arch"_${{ steps.version.outputs.version }}.tar.gz libusearch_c.so
229
+ mv usearch_wasm_linux_"$arch"_${{ steps.version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
230
+ done
231
+ if: matrix.os == 'ubuntu-22.04'
232
+
233
+ - name: Build library on MacOS
234
+ run: |
235
+ export WASI_VERSION=20
236
+ export WASI_VERSION_FULL=${WASI_VERSION}.0
237
+ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
238
+ tar xf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
239
+ rm -rf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
240
+ export WASI_SDK_PATH=/Users/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
241
+ archs=("x86_64" "arm64")
242
+ cd ./c
243
+ for arch in "${archs[@]}"
244
+ do
245
+ ../wasi-sdk-20.0/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
246
+ zip -r usearch_wasm_macos_"$arch"_${{ steps.version.outputs.version }}.zip libusearch_c.so
247
+ mv usearch_wasm_macos_"$arch"_${{ steps.version.outputs.version }}.zip ../ && rm -rf libusearch_c.so
248
+ done
249
+ if: matrix.os == 'macOS-11'
250
+
251
+ - name: Build library on Windows
252
+ run: |
253
+ export WASI_VERSION=20
254
+ export WASI_VERSION_FULL=${WASI_VERSION}.0
255
+ curl -LOJ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
256
+ tar xf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
257
+ rm -rf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
258
+ export WASI_SDK_PATH=/d/a/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}+m
259
+ archs=("x64" "x86")
260
+ cd ./c
261
+ for arch in "${archs[@]}"
262
+ do
263
+ ../wasi-sdk-20.0+m/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.so -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
264
+ tar -cvf usearch_wasm_windows_"$arch"_${{ steps.version.outputs.version }}.tar.gz libusearch_c.so
265
+ mv usearch_wasm_windows_"$arch"_${{ steps.version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
266
+ done
267
+ shell: bash
268
+ if: matrix.os == 'windows-2022'
269
+
270
+ - name: Upload archive
271
+ uses: xresloader/upload-to-github-release@v1
272
+ env:
273
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
274
+ with:
275
+ file: "*.zip;*.tar.gz"
276
+ update_latest_release: true
283
277
 
284
278
  publish_checksums:
285
279
  name: Compute Assets Checksums
286
- runs-on: ubuntu-latest
287
- needs: [versioning, create_linux_deb_package, create_windows_dll_library, create_macos_library, deploy_docs_pages, wasm_c_library]
280
+ runs-on: ubuntu-22.04
281
+ needs:
282
+ [
283
+ versioning,
284
+ create_linux_deb_package,
285
+ create_windows_dll_library,
286
+ create_macos_library,
287
+ wasm_c_library,
288
+ deploy_docs_pages,
289
+ ]
288
290
  steps:
289
- - name: Get last release ID
290
- id: last_release
291
- run: |
291
+ - name: Get last release ID
292
+ id: last_release
293
+ run: |
292
294
  response=$(curl -s -H "Authorization: Bearer ${{ secrets.SEMANTIC_RELEASE_TOKEN }}" \
293
295
  "https://api.github.com/repos/${{ github.repository }}/releases/latest")
294
296
  echo "last_release_id=$(echo "$response" | jq -r '.id')" >> $GITHUB_OUTPUT
295
297
 
296
- - uses: robinraju/release-downloader@v1.8
297
- name: Download release assets
298
- with:
299
- latest: true
300
- fileName: "*"
301
- out-file-path: "downloads"
302
- tarBall: true
303
- zipBall: true
304
-
305
- - name: Calculate source hashes
306
- id: hashes
307
- run: |
308
- i=1
309
- cd $GITHUB_WORKSPACE/downloads
310
- for asset_name in $(ls); do
311
- asset_hash=$(sha256sum $asset_name | awk '{print $1}')
312
- echo "asset_name_$i=$asset_name" >> $GITHUB_OUTPUT
313
- echo "asset_hash_$i=$asset_hash" >> $GITHUB_OUTPUT
314
- i=$((i+1))
315
- done
316
-
317
- - name: Upload hashes to release
318
- uses: irongut/EditRelease@v1.2.0
319
- with:
320
- token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
321
- id: ${{ steps.last_release.outputs.last_release_id }}
322
- prerelease: false
323
- replacebody: false
324
- body: |
298
+ - uses: robinraju/release-downloader@v1.8
299
+ name: Download release assets
300
+ with:
301
+ latest: true
302
+ fileName: "*"
303
+ out-file-path: "downloads"
304
+ tarBall: true
305
+ zipBall: true
306
+
307
+ - name: Calculate source hashes
308
+ id: hashes
309
+ run: |
310
+ i=1
311
+ cd $GITHUB_WORKSPACE/downloads
312
+ for asset_name in $(ls); do
313
+ asset_hash=$(sha256sum $asset_name | awk '{print $1}')
314
+ echo "asset_name_$i=$asset_name" >> $GITHUB_OUTPUT
315
+ echo "asset_hash_$i=$asset_hash" >> $GITHUB_OUTPUT
316
+ i=$((i+1))
317
+ done
318
+
319
+ - name: Upload hashes to release
320
+ uses: irongut/EditRelease@v1.2.0
321
+ with:
322
+ token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
323
+ id: ${{ steps.last_release.outputs.last_release_id }}
324
+ prerelease: false
325
+ replacebody: false
326
+ body: |
325
327
  ## Hashes
326
328
  * ${{ steps.hashes.outputs.asset_name_1 }} : `${{ steps.hashes.outputs.asset_hash_1 }}`
327
329
  * ${{ steps.hashes.outputs.asset_name_2 }} : `${{ steps.hashes.outputs.asset_hash_2 }}`
@@ -339,29 +341,28 @@ jobs:
339
341
  * ${{ steps.hashes.outputs.asset_name_14 }} : `${{ steps.hashes.outputs.asset_hash_14 }}`
340
342
  * ${{ steps.hashes.outputs.asset_name_15 }} : `${{ steps.hashes.outputs.asset_hash_15 }}`
341
343
 
342
-
343
344
  build_wheels:
344
345
  name: Build Python
345
346
  needs: versioning
346
347
  runs-on: ${{ matrix.os }}
347
348
  strategy:
348
349
  matrix:
349
- os: [ubuntu-20.04, macOS-11, windows-2022]
350
+ os: [ubuntu-22.04, macOS-11, windows-2022]
350
351
 
351
352
  steps:
352
353
  - uses: actions/checkout@v3
353
354
  with:
354
- ref: 'main'
355
+ ref: "main"
355
356
  - uses: actions/setup-python@v3
356
-
357
+
357
358
  - name: Setup Docker
358
- if: matrix.os == 'ubuntu-20.04'
359
+ if: matrix.os == 'ubuntu-22.04'
359
360
  uses: crazy-max/ghaction-setup-docker@v1.0.0
360
361
  with:
361
362
  version: 23.0.1
362
363
 
363
364
  - name: Setup QEMU
364
- if: matrix.os == 'ubuntu-20.04'
365
+ if: matrix.os == 'ubuntu-22.04'
365
366
  uses: docker/setup-qemu-action@v2.1.0
366
367
 
367
368
  - name: Install CIBuildWheel
@@ -373,12 +374,11 @@ jobs:
373
374
  - uses: actions/upload-artifact@v3
374
375
  with:
375
376
  path: ./wheelhouse/*.whl
376
-
377
-
377
+
378
378
  publish_python:
379
379
  name: Publish Python
380
380
  needs: build_wheels
381
- runs-on: ubuntu-20.04
381
+ runs-on: ubuntu-22.04
382
382
  environment:
383
383
  name: pypi
384
384
  url: https://pypi.org/p/usearch
@@ -401,128 +401,144 @@ jobs:
401
401
  publish_javascript:
402
402
  name: Publish JavaScript
403
403
  needs: versioning
404
- runs-on: ubuntu-latest
404
+ runs-on: ubuntu-22.04
405
+ env:
406
+ CC: gcc-12
407
+ CXX: g++-12
408
+
405
409
  steps:
406
410
  - uses: actions/checkout@v3
407
411
  with:
408
- ref: 'main'
412
+ ref: "main"
409
413
  - run: git submodule update --init --recursive
410
- - uses: actions/setup-node@v3
414
+
415
+ - name: Update compilers
416
+ run: |
417
+ sudo apt update
418
+ sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12
419
+
420
+ - name: Set up Node.js
421
+ uses: actions/setup-node@v3
411
422
  with:
412
423
  node-version: 18
413
- - run: npm install
414
- - run: npm ci
415
- - run: npm test
416
- - uses: JS-DevTools/npm-publish@v2
424
+
425
+ - name: Build and Test
426
+ run: |
427
+ npm install
428
+ npm ci
429
+ npm test
430
+
431
+ - name: Publish
432
+ uses: JS-DevTools/npm-publish@v2
417
433
  with:
418
434
  token: ${{ secrets.NPM_TOKEN }}
419
435
 
420
436
  publish_rust:
421
437
  name: Publish Rust
422
438
  needs: versioning
423
- runs-on: ubuntu-latest
439
+ runs-on: ubuntu-22.04
424
440
  steps:
425
- - uses: actions/checkout@v3
426
- with:
427
- ref: 'main'
428
- - run: git submodule update --init --recursive
429
- - uses: actions-rs/toolchain@v1
430
- with:
441
+ - uses: actions/checkout@v3
442
+ with:
443
+ ref: "main"
444
+ - run: git submodule update --init --recursive
445
+ - uses: actions-rs/toolchain@v1
446
+ with:
431
447
  toolchain: stable
432
448
  override: true
433
- - uses: katyo/publish-crates@v2
434
- with:
435
- registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
449
+ - uses: katyo/publish-crates@v2
450
+ with:
451
+ registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
436
452
 
437
453
  publish_java:
438
454
  name: Publish Java
439
455
  needs: versioning
440
- runs-on: ubuntu-latest
456
+ runs-on: ubuntu-22.04
441
457
  permissions:
442
458
  contents: read
443
459
  packages: write
444
460
  steps:
445
- - uses: actions/checkout@v3
446
- with:
447
- ref: 'main'
448
- - run: git submodule update --init --recursive
449
- - uses: actions/setup-java@v3
450
- with:
451
- java-version: '11'
452
- distribution: 'adopt'
453
- - name: Setup Gradle
454
- uses: gradle/gradle-build-action@v2.4.2
455
- - name: Execute Gradle build
456
- run: gradle clean build
457
- - name: Publish package
458
- run: gradle publish -PsignArtifacts=false
459
- env:
460
- MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
461
- MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
462
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
461
+ - uses: actions/checkout@v3
462
+ with:
463
+ ref: "main"
464
+ - run: git submodule update --init --recursive
465
+ - uses: actions/setup-java@v3
466
+ with:
467
+ java-version: "11"
468
+ distribution: "adopt"
469
+ - name: Setup Gradle
470
+ uses: gradle/gradle-build-action@v2.4.2
471
+ - name: Execute Gradle build
472
+ run: gradle clean build
473
+ - name: Publish package
474
+ run: gradle publish -PsignArtifacts=false
475
+ env:
476
+ MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
477
+ MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
478
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
463
479
 
464
480
  publish_swift:
465
481
  name: Publish ObjC & Swift
466
482
  needs: versioning
467
- runs-on: macos-latest
483
+ runs-on: macos-12
468
484
  steps:
469
- - uses: actions/checkout@v3
470
- with:
471
- ref: 'main'
472
- - run: git submodule update --init --recursive
473
- - name: Build
474
- run: swift build
475
- - name: Run tests
476
- run: swift test
485
+ - uses: actions/checkout@v3
486
+ with:
487
+ ref: "main"
488
+ - run: git submodule update --init --recursive
489
+ - name: Build
490
+ run: swift build
491
+ - name: Run tests
492
+ run: swift test
477
493
 
478
494
  # Publishes to both Docker Hub and GitHub Container Registry
479
495
  # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub-and-github-packages
480
496
  publish_docker:
481
497
  name: Publish Docker Image
482
498
  needs: versioning
483
- runs-on: ubuntu-latest
499
+ runs-on: ubuntu-22.04
484
500
  permissions:
485
501
  contents: read
486
502
  packages: write
487
503
  steps:
488
- - uses: actions/checkout@v3
489
- with:
490
- ref: 'main'
491
- - run: git submodule update --init --recursive
492
- - name: Login to Docker Hub
493
- uses: docker/login-action@v2
494
- with:
495
- username: ${{ secrets.DOCKERHUB_USERNAME }}
496
- password: ${{ secrets.DOCKERHUB_TOKEN }}
497
- - name: Log in to GitHub Registry
498
- uses: docker/login-action@v2
499
- with:
500
- registry: ghcr.io
501
- username: ${{ github.actor }}
502
- password: ${{ secrets.GITHUB_TOKEN }}
503
- - name: Set up Docker Buildx
504
- uses: docker/setup-buildx-action@v2
505
- - name: Extract tags & labels for Docker
506
- id: meta
507
- uses: docker/metadata-action@v4
508
- with:
509
- images: |
510
- unum/usearch
511
- ghcr.io/${{ github.repository }}
512
- - name: Build and push
513
- uses: docker/build-push-action@v4
514
- with:
515
- context: .
516
- push: true
517
- tags: ${{ steps.meta.outputs.tags }}
518
- labels: ${{ steps.meta.outputs.labels }}
504
+ - uses: actions/checkout@v3
505
+ with:
506
+ ref: "main"
507
+ - run: git submodule update --init --recursive
508
+ - name: Login to Docker Hub
509
+ uses: docker/login-action@v2
510
+ with:
511
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
512
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
513
+ - name: Log in to GitHub Registry
514
+ uses: docker/login-action@v2
515
+ with:
516
+ registry: ghcr.io
517
+ username: ${{ github.actor }}
518
+ password: ${{ secrets.GITHUB_TOKEN }}
519
+ - name: Set up Docker Buildx
520
+ uses: docker/setup-buildx-action@v2
521
+ - name: Extract tags & labels for Docker
522
+ id: meta
523
+ uses: docker/metadata-action@v4
524
+ with:
525
+ images: |
526
+ unum/usearch
527
+ ghcr.io/${{ github.repository }}
528
+ - name: Build and push
529
+ uses: docker/build-push-action@v4
530
+ with:
531
+ context: .
532
+ push: true
533
+ tags: ${{ steps.meta.outputs.tags }}
534
+ labels: ${{ steps.meta.outputs.labels }}
519
535
 
520
536
  build_csharp:
521
- name: Build C#
537
+ name: Build C Dependencies for C#
522
538
  needs: versioning
523
539
  strategy:
524
540
  matrix:
525
- os: [ubuntu-latest, macos-latest, windows-latest]
541
+ os: [ubuntu-22.04, macos-12, windows-2022]
526
542
  runs-on: ${{ matrix.os }}
527
543
  defaults:
528
544
  run:
@@ -530,39 +546,48 @@ jobs:
530
546
  steps:
531
547
  - uses: actions/checkout@v3
532
548
  with:
533
- ref: 'main'
549
+ ref: "main"
534
550
  - run: git submodule update --init --recursive
535
551
 
536
- - name: Ubuntu/macOS build usearch shared obj
537
- if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
538
- run: ./build_lib.sh
539
- working-directory: ${{ github.workspace }}/csharp/eng
540
-
541
- - name: Windows MSVC build usearch dll
542
- if: matrix.os == 'windows-latest'
552
+ - name: Build C library for Linux
553
+ if: matrix.os == 'ubuntu-22.04'
543
554
  run: |
544
- call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
545
- where cl
546
- cl /EHsc /std:c++14 /O2 /LD /Fe:libusearch_c.dll lib.cpp /I. /I../include/ /I../fp16/include/
547
- working-directory: ${{ github.workspace }}/c
548
- shell: cmd
549
-
550
- - name: Windows copy dll
551
- if: matrix.os == 'windows-latest'
555
+ sudo apt update
556
+ sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12
557
+ cmake -B build_artifacts -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_TEST_C=0 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1
558
+ cmake --build build_artifacts --config Release
559
+ mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
560
+ cp "${{ github.workspace }}/build_artifacts/libusearch_c.so" "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
561
+
562
+ - name: Build C library for MacOS
563
+ if: matrix.os == 'macos-12'
552
564
  run: |
553
- mkdir -p "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native"
554
- cp "${GITHUB_WORKSPACE}/c/libusearch_c.dll" "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native"
565
+ brew update
566
+ brew install cmake
567
+ cmake -B build_artifacts -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_TEST_C=0 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=0
568
+ cmake --build build_artifacts --config Release
569
+ mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
570
+ cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
571
+
572
+ - name: Build C library for Windows
573
+ if: matrix.os == 'windows-2022'
574
+ run: |
575
+ choco install cmake
576
+ cmake -B build_artifacts -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_TEST_C=0 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=0 -DUSEARCH_USE_JEMALLOC=0
577
+ cmake --build build_artifacts --config Release
578
+ mkdir -p "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
579
+ cp "${{ github.workspace }}\build_artifacts\libusearch_c.dll" "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
555
580
  shell: bash
556
581
 
557
582
  - name: Upload Artifacts
558
583
  uses: actions/upload-artifact@v3
559
584
  with:
560
- name: usearch-libs
585
+ name: usearch-csharp-dependencies
561
586
  path: ${{ github.workspace }}/csharp/lib/**/*
562
587
 
563
588
  publish_csharp:
564
589
  name: Publish C#
565
- runs-on: ubuntu-latest
590
+ runs-on: ubuntu-22.04
566
591
  needs: [build_csharp]
567
592
  env:
568
593
  SOLUTION: ${{ github.workspace }}/csharp
@@ -574,19 +599,19 @@ jobs:
574
599
  steps:
575
600
  - uses: actions/checkout@v3
576
601
  with:
577
- ref: 'main'
602
+ ref: "main"
578
603
  - run: git submodule update --init --recursive
579
-
604
+
580
605
  - name: Download usearch libs artifact
581
606
  uses: actions/download-artifact@v3
582
607
  with:
583
- name: usearch-libs
608
+ name: usearch-csharp-dependencies
584
609
  path: ${{ env.USEARCH_LIBS }}
585
610
 
586
611
  - name: Setup .NET
587
612
  uses: actions/setup-dotnet@v3
588
613
  with:
589
- dotnet-version: 7.0.x
614
+ dotnet-version: 7.0.x
590
615
 
591
616
  - name: Pack project
592
617
  run: |
@@ -606,20 +631,29 @@ jobs:
606
631
  name: Build Docs
607
632
  runs-on: ubuntu-22.04
608
633
  if: ${{ always() }}
609
- needs: [publish_python, publish_javascript, publish_rust, publish_java, publish_swift, publish_docker, publish_csharp]
634
+ needs:
635
+ [
636
+ publish_python,
637
+ publish_javascript,
638
+ publish_rust,
639
+ publish_java,
640
+ publish_swift,
641
+ publish_docker,
642
+ publish_csharp,
643
+ ]
610
644
  permissions:
611
645
  contents: write
612
646
  steps:
613
647
  - name: Checkout
614
648
  uses: actions/checkout@v3
615
649
  with:
616
- ref: 'main'
650
+ ref: "main"
617
651
  - name: Install dependencies
618
652
  run: |
619
- sudo apt update &&
620
- sudo apt install -y doxygen graphviz dia git &&
621
- pip install sphinx==5.3.0 sphinx-js==3.2.1 breathe==4.35.0 furo==2023.3.27 m2r2==0.3.3.post2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery==4.1 &&
622
- npm install -g jsdoc
653
+ sudo apt update &&
654
+ sudo apt install -y doxygen graphviz dia git &&
655
+ pip install sphinx==5.3.0 sphinx-js==3.2.1 breathe==4.35.0 furo==2023.3.27 m2r2==0.3.3.post2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery==4.1 &&
656
+ npm install -g jsdoc
623
657
  - name: Install USearch from PyPi
624
658
  run: pip install usearch
625
659
  - name: Build documentation
@@ -638,7 +672,7 @@ jobs:
638
672
 
639
673
  deploy_docs_pages:
640
674
  name: Deploy GitHub Pages
641
- environment:
675
+ environment:
642
676
  name: github-pages
643
677
  url: ${{ steps.deployment.outputs.page_url }}
644
678
  runs-on: ubuntu-22.04
@@ -671,4 +705,4 @@ jobs:
671
705
  uses: fjogeleit/http-request-action@v1
672
706
  with:
673
707
  url: ${{ secrets.DOCS_VERCEL }}
674
- method: 'POST'
708
+ method: "POST"