Skip to content

Commit e42b2dc

Browse files
authored
Merge: Type Hints, Graph Iterators, Builds, & Safety
2 parents 22d59bb + f900b5a commit e42b2dc

24 files changed

Lines changed: 821 additions & 156 deletions

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ body:
9292
id: terms
9393
attributes:
9494
label: Code of Conduct
95-
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/unum-cloud/USearch/blob/main/CODE_OF_CONDUCT.md)
95+
description: By submitting this issue, you agree to follow our [Code of
96+
Conduct](https://github.com/unum-cloud/USearch/blob/main/CODE_OF_CONDUCT.md)
9697
options:
9798
- label: I agree to follow this project's Code of Conduct
9899
required: true

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ body:
5858
id: terms
5959
attributes:
6060
label: Code of Conduct
61-
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/unum-cloud/USearch/blob/main/CODE_OF_CONDUCT.md)
61+
description: By submitting this issue, you agree to follow our [Code of
62+
Conduct](https://github.com/unum-cloud/USearch/blob/main/CODE_OF_CONDUCT.md)
6263
options:
6364
- label: I agree to follow this project's Code of Conduct
6465
required: true

.github/workflows/prerelease.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jobs:
6868
uses: actions/checkout@v6
6969
- name: Pull Git submodules
7070
run: git submodule update --init --recursive
71-
7271
# C/C++
7372
- name: Build C/C++
7473
run: |
@@ -80,7 +79,6 @@ jobs:
8079
run: build_artifacts/test_cpp
8180
- name: Test C
8281
run: build_artifacts/test_c
83-
8482
# Python
8583
- name: Set up Python ${{ env.PYTHON_VERSION }}
8684
uses: actions/setup-python@v6
@@ -94,7 +92,6 @@ jobs:
9492
python -m pip install .
9593
- name: Test Python
9694
run: pytest
97-
9895
# JavaScript
9996
- name: Set up Node.js
10097
uses: actions/setup-node@v6
@@ -106,7 +103,6 @@ jobs:
106103
run: npm run build-js
107104
- name: Test JavaScript
108105
run: npm test
109-
110106
# Rust
111107
- name: Set up Rust
112108
run: |
@@ -120,7 +116,6 @@ jobs:
120116
run: cargo build
121117
- name: Test Rust
122118
run: cargo test
123-
124119
# Java
125120
- name: Setup Java
126121
uses: actions/setup-java@v5
@@ -133,7 +128,6 @@ jobs:
133128
run: gradle spotlessCheck
134129
- name: Test Java
135130
run: gradle clean build
136-
137131
# C#
138132
- name: Setup .NET ${{ env.DOTNET_VERSION }}
139133
uses: actions/setup-dotnet@v5
@@ -146,7 +140,6 @@ jobs:
146140
dotnet test -c Debug --logger "console;verbosity=detailed"
147141
shell: bash
148142
working-directory: ${{ github.workspace }}/csharp
149-
150143
# GoLang
151144
# With `LD_DEBUG=all` we detect the addresses of the libraries that are loaded
152145
- name: Test GoLang
@@ -168,7 +161,6 @@ jobs:
168161
uses: actions/checkout@v6
169162
- name: Pull Git submodules
170163
run: git submodule update --init --recursive
171-
172164
# C/C++
173165
- name: Build C/C++
174166
run: |
@@ -180,7 +172,6 @@ jobs:
180172
run: build_artifacts/test_cpp
181173
- name: Test C
182174
run: build_artifacts/test_c
183-
184175
# JavaScript
185176
- name: Set up Node.js
186177
uses: actions/setup-node@v6
@@ -192,7 +183,6 @@ jobs:
192183
run: npm run build-js
193184
- name: Test JavaScript
194185
run: npm test
195-
196186
# Python
197187
- name: Set up Python ${{ env.PYTHON_VERSION }}
198188
uses: actions/setup-python@v6
@@ -209,7 +199,6 @@ jobs:
209199
CC: clang++ # Override the default compiler
210200
- name: Test Python
211201
run: pytest
212-
213202
# Rust
214203
- name: Set up Rust
215204
run: |
@@ -220,7 +209,6 @@ jobs:
220209
run: cargo build
221210
- name: Test Rust
222211
run: cargo test
223-
224212
# C#
225213
- name: Setup .NET ${{ env.DOTNET_VERSION }}
226214
uses: actions/setup-dotnet@v5
@@ -243,7 +231,6 @@ jobs:
243231
uses: actions/checkout@v6
244232
- name: Pull Git submodules
245233
run: git submodule update --init --recursive
246-
247234
# C/C++
248235
- name: Build C/C++
249236
run: |
@@ -255,7 +242,6 @@ jobs:
255242
run: build_artifacts/test_cpp
256243
- name: Test C
257244
run: build_artifacts/test_c
258-
259245
# JavaScript
260246
- name: Set up Node.js
261247
uses: actions/setup-node@v6
@@ -267,7 +253,6 @@ jobs:
267253
run: npm run build-js
268254
- name: Test JavaScript
269255
run: npm test
270-
271256
# Python
272257
- name: Set up Python ${{ env.PYTHON_VERSION }}
273258
uses: actions/setup-python@v6
@@ -283,13 +268,11 @@ jobs:
283268
CC: clang++ # Override the default compiler
284269
- name: Test Python
285270
run: pytest
286-
287271
# ObjC/Swift
288272
- name: Build ObjC/Swift
289273
run: swift build
290274
- name: Test ObjC/Swift
291275
run: swift test
292-
293276
# Rust
294277
- name: Set up Rust
295278
run: |
@@ -300,7 +283,6 @@ jobs:
300283
run: cargo build
301284
- name: Test Rust
302285
run: cargo test
303-
304286
# C#
305287
- name: Setup .NET ${{ env.DOTNET_VERSION }}
306288
uses: actions/setup-dotnet@v5
@@ -322,7 +304,6 @@ jobs:
322304
uses: actions/checkout@v6
323305
- name: Pull Git submodules
324306
run: git submodule update --init --recursive
325-
326307
# C/C++
327308
- name: Build C/C++
328309
run: |
@@ -333,7 +314,6 @@ jobs:
333314
run: .\build_artifacts\test_cpp.exe
334315
- name: Test C
335316
run: .\build_artifacts\test_c.exe
336-
337317
# Python
338318
- name: Set up Python ${{ env.PYTHON_VERSION }}
339319
uses: actions/setup-python@v6
@@ -346,7 +326,6 @@ jobs:
346326
python -m pip install .
347327
- name: Test Python
348328
run: pytest
349-
350329
# JavaScript
351330
- name: Set up Node.js
352331
uses: actions/setup-node@v6
@@ -358,7 +337,6 @@ jobs:
358337
run: npm run build-js
359338
- name: Test JavaScript
360339
run: npm test
361-
362340
# Rust
363341
- name: Set up Rust
364342
run: |
@@ -369,7 +347,6 @@ jobs:
369347
run: cargo build
370348
- name: Test Rust
371349
run: cargo test
372-
373350
# C#
374351
- name: Setup .NET ${{ env.DOTNET_VERSION }}
375352
uses: actions/setup-dotnet@v5
@@ -394,7 +371,6 @@ jobs:
394371

395372
- name: Setup MSVC for ARM64
396373
uses: microsoft/setup-msbuild@v2
397-
398374
# C/C++
399375
- name: Build C/C++ (ARM64)
400376
run: |
@@ -547,7 +523,6 @@ jobs:
547523
uses: actions/checkout@v6
548524
- name: Pull Git submodules
549525
run: git submodule update --init --recursive
550-
551526
# C/C++
552527
# We need to install the cross-compilation toolchain for ARM64 and ARMHF
553528
- name: Install dependencies
@@ -570,7 +545,6 @@ jobs:
570545
-D USEARCH_BUILD_BENCH_CPP=0
571546
572547
cmake --build build_artifacts --config RelWithDebInfo
573-
574548
# We can't run the produced builds, but we can make sure they exist
575549
- name: Test artifacts presence
576550
run: |
@@ -616,11 +590,9 @@ jobs:
616590
-D USEARCH_BUILD_BENCH_CPP=0
617591
618592
cmake --build build_artifacts --config RelWithDebInfo
619-
620593
# We can't run the produced builds, but we can make sure they exist
621594
- name: Test artifacts presence
622595
run: test -e build_artifacts/libusearch_c.so
623-
624596
# Rust
625597
- name: Set up Rust
626598
run: |
@@ -641,14 +613,12 @@ jobs:
641613
642614
- name: Build Rust
643615
run: cargo build --target ${{ matrix.target }}
644-
645616
# Java
646617
- name: Set up JDK 21
647618
uses: actions/setup-java@v5
648619
with:
649620
java-version: ${{ env.JAVA_VERSION }}
650621
distribution: "adopt"
651-
652622
# We skip native compilation with Gradle and focus just on the Java part,
653623
# assuming the we won't be able to tun the tests without emulation
654624
- name: Check Java formatting

.github/workflows/release.yml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,29 @@ jobs:
213213
214214
- name: Build library (MinGW)
215215
if: matrix.arch != 'arm64'
216+
# `-G "MinGW Makefiles"` is required: without it, CMake on the
217+
# `windows-2022` runner falls back to the Visual Studio generator
218+
# (x64 by default), so the `x86` matrix entry was silently producing
219+
# a 64-bit DLL and shipping it under the `windows_x86` archive name.
216220
run: |
217-
cmake -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=0 -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_BENCH_CPP=0 -B ./build_release
221+
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=0 -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_BENCH_CPP=0 -B ./build_release
218222
cmake --build ./build_release --config Release
219223
mkdir pkg
220224
copy .\build_release\libusearch_c.dll pkg\
221225
copy .\c\usearch.h pkg\
222226
tar -cvf usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar -C pkg libusearch_c.dll usearch.h
227+
# Guard against silent generator fallback — the DLL must match the
228+
# advertised matrix arch, otherwise the archive ships a mislabeled binary.
229+
- name: Verify Windows DLL architecture
230+
if: matrix.arch != 'arm64'
231+
shell: bash
232+
run: |
233+
case "${{ matrix.arch }}" in
234+
x64) expected='x86-64' ;;
235+
x86) expected='80386\|Intel 80386' ;;
236+
esac
237+
file ./build_release/libusearch_c.dll
238+
file ./build_release/libusearch_c.dll | grep -q "$expected"
223239
224240
- name: Build library (MSVC ARM64)
225241
if: matrix.arch == 'arm64'
@@ -420,8 +436,11 @@ jobs:
420436
- name: Install dependencies
421437
run: |
422438
sudo apt-get update
423-
sudo apt-get install -y clang lld make crossbuild-essential-arm64 crossbuild-essential-armhf
439+
sudo apt-get install -y clang mold make crossbuild-essential-arm64 crossbuild-essential-armhf
424440
441+
# `-fuse-ld=mold` keeps clang LTO on while sidestepping the
442+
# experimental `lld 1:18.0-59~exp2` from Noble universe that
443+
# segfaults on the widened `nk_shared` LTO unit.
425444
- name: Build JNI library
426445
run: |
427446
cmake -B build_artifacts \
@@ -430,6 +449,9 @@ jobs:
430449
-DCMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
431450
-DCMAKE_SYSTEM_NAME=Linux \
432451
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.cmake_processor }} \
452+
-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=mold \
453+
-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=mold \
454+
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold \
433455
-DUSEARCH_BUILD_JNI=1 \
434456
-DUSEARCH_BUILD_TEST_CPP=0 \
435457
-DUSEARCH_BUILD_BENCH_CPP=0 \
@@ -728,8 +750,7 @@ jobs:
728750
strategy:
729751
matrix:
730752
os: [ubuntu-24.04, macos-14, windows-2022]
731-
python-version:
732-
["310", "311", "312", "313", "313t", "314", "314t"]
753+
python-version: ["310", "311", "312", "313", "313t", "314", "314t"]
733754
steps:
734755
- name: Check out refreshed version
735756
uses: actions/checkout@v6
@@ -892,7 +913,6 @@ jobs:
892913

893914
- name: Look for links
894915
run: find . -type f -links +1
895-
896916
# NPM installation fails spuriously all the time
897917
- name: Install Dependencies
898918
run: |
@@ -928,14 +948,7 @@ jobs:
928948

929949
publish_java:
930950
name: Publish Java
931-
needs:
932-
[
933-
versioning,
934-
build_jni_linux,
935-
build_jni_windows,
936-
build_jni_macos,
937-
build_jni_android,
938-
]
951+
needs: [versioning, build_jni_linux, build_jni_windows, build_jni_macos, build_jni_android]
939952
runs-on: ubuntu-24.04
940953
permissions:
941954
contents: write
@@ -1186,28 +1199,22 @@ jobs:
11861199
working-directory: ${{ github.workspace }}
11871200

11881201
- name: Publish to NuGet
1189-
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.NUGET_API }}" --source "${{ env.NUGET_SOURCE }}" --skip-duplicate
1202+
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.NUGET_API }}" --source "${{
1203+
env.NUGET_SOURCE }}" --skip-duplicate
11901204

11911205
- name: Prepare publish to GitHub Registry
1192-
run: dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "${{ env.GITHUB_PACKAGES_SOURCE }}"
1206+
run: dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }}
1207+
--store-password-in-clear-text --name github "${{ env.GITHUB_PACKAGES_SOURCE }}"
11931208

11941209
- name: Publish to GitHub Registry
1195-
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source "github" --skip-duplicate
1210+
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source "github"
1211+
--skip-duplicate
11961212

11971213
build_docs:
11981214
name: Build Docs
11991215
runs-on: ubuntu-24.04
12001216
if: ${{ always() }}
1201-
needs:
1202-
[
1203-
publish_python,
1204-
publish_javascript,
1205-
publish_rust,
1206-
publish_java,
1207-
publish_swift,
1208-
publish_docker,
1209-
publish_csharp,
1210-
]
1217+
needs: [publish_python, publish_javascript, publish_rust, publish_java, publish_swift, publish_docker, publish_csharp]
12111218
permissions:
12121219
contents: write
12131220
steps:
@@ -1223,7 +1230,6 @@ jobs:
12231230
npm install -g jsdoc typedoc
12241231
- name: Install USearch from PyPi
12251232
run: pip install usearch
1226-
12271233
# NPM installation fails spuriously all the time
12281234
- name: Build CJS JS
12291235
run: |

0 commit comments

Comments
 (0)