usearch 2.7.7 → 2.8.1

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