-
Notifications
You must be signed in to change notification settings - Fork 140
889 lines (810 loc) · 30.8 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
name: Release
on:
push:
branches: ["main"]
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: write
pages: write
id-token: write
packages: write
jobs:
versioning:
name: Update Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/[email protected]
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
package.json:"version": "(\d+\.\d+\.\d+)"
CITATION.cff:^version: (\d+\.\d+\.\d+)
Cargo.toml:^version = "(\d+\.\d+\.\d+)"
Cargo.lock:name = "usearch"\nversion = "(\d+\.\d+\.\d+)"
wasmer.toml:^version = "(\d+\.\d+\.\d+)"
conanfile.py:version = "(\d+\.\d+\.\d+)"
java/README.md:<version>(\d+\.\d+\.\d+)</version>
README.md:version = {(\d+\.\d+\.\d+)}
csharp/nuget/nuget-package.props:>(\d+\.\d+\.\d+)</Version>
CMakeLists.txt:VERSION (\d+\.\d+\.\d+)
update-major-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MINOR (\d+)
update-patch-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_PATCH (\d+)
dry-run: "false"
push: "true"
create-release: "true"
github-token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
rebase:
name: Rebase Dev. Branch
needs: versioning
runs-on: ubuntu-22.04
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Perform rebase
run: |
git fetch origin main
git checkout main-dev
git rebase origin/main
- name: Push changes
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
branch: main-dev
unprotect_reviews: True
force: True
create_linux_deb_package:
name: Create Debian Package
runs-on: ubuntu-22.04
needs: versioning
env:
CC: clang
CXX: clang++
AR: llvm-ar
NM: llvm-nm
RANLIB: llvm-ranlib
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
target: x86_64-linux-gnu
- arch: arm64
target: aarch64-linux-gnu
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Get version
id: set_version
run: |
version=$(cat VERSION)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang lld make crossbuild-essential-arm64 crossbuild-essential-armhf libjemalloc-dev
- name: Build C/C++
run: |
# Configure and build the project
cmake -B build_release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_C_COMPILER_TARGET=${{ matrix.target }} \
-DCMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} \
-DUSEARCH_BUILD_LIB_C=1 \
-DUSEARCH_BUILD_SQLITE=1 \
-DUSEARCH_BUILD_TEST_CPP=0 \
-DUSEARCH_BUILD_BENCH_CPP=0
cmake --build build_release --config Release
cp build_release/libusearch_c.so "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.so"
cp build_release/libusearch_sqlite.so "usearch_sqlite_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.so"
mkdir -p "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/DEBIAN"
touch "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/DEBIAN/control"
mkdir -p "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/usr/local/lib"
mkdir "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/usr/local/include"
cp c/usearch.h "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/usr/local/include/"
cp build_release/libusearch_c.so "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/usr/local/lib/"
echo -e "Package: usearch\nVersion: ${{ steps.set_version.outputs.version }}\nMaintainer: Ash Vardanian\nArchitecture: ${{ matrix.arch }}\nDescription: Faster & Smaller Single-File Search Engine for Vectors & Texts" > "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}/DEBIAN/control"
dpkg-deb --build "usearch_linux_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}"
- name: Upload library
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.so;*.deb"
update_latest_release: true
create_windows_dll_library:
name: Create Dll Library for Windows
runs-on: windows-2022
needs: versioning
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "^1.19.0"
- name: Setup MinGW
uses: egor-tensin/setup-mingw@v2
with:
platform: ${{ matrix.arch }}
version: 12.2.0
- name: Get version
id: set_version
shell: bash
run: |
version=$(cat VERSION)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Build library
run: |
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
cmake --build ./build_release --config Release
tar -cvf usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar .\build_release\libusearch_c.dll .\c\usearch.h
- name: Upload archive
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "usearch_windows_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.tar"
update_latest_release: true
create_macos_dylib_library:
name: Create Library for MacOS
runs-on: macos-12
needs: versioning
strategy:
fail-fast: false
matrix:
arch: [arm64, x86_64]
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "^1.21.0"
- name: Get version
id: set_version
run: |
version=$(cat VERSION)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Build library
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-DUSEARCH_BUILD_LIB_C=1 \
-DUSEARCH_BUILD_SQLITE=1 \
-DUSEARCH_BUILD_TEST_CPP=0 \
-DUSEARCH_BUILD_BENCH_CPP=0 \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
-B ./build_release
cmake --build ./build_release --config Release
zip -r usearch_macos_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.zip build_release/libusearch_c.dylib c/usearch.h
mv build_release/libusearch_sqlite.dylib usearch_sqlite_macos_${{ matrix.arch }}_${{ steps.set_version.outputs.version }}.dylib
- name: Upload library
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.dylib"
update_latest_release: true
- name: Upload archive
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.zip"
update_latest_release: true
create_wasm_library:
name: WASM builds for C libraries
runs-on: ${{ matrix.os }}
needs: versioning
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macOS-11, windows-2022]
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Get version
id: set_version
run: |
version=$(cat VERSION)
echo "version=$version" >> $GITHUB_OUTPUT
shell: bash
- name: Build library on Ubuntu
run: |
export WASI_VERSION=20
export WASI_VERSION_FULL=${WASI_VERSION}.0
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
tar xf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
rm -rf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
export WASI_SDK_PATH=/home/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
archs=("x86_64" "arm64")
cd ./c
for arch in "${archs[@]}"
do
../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"
tar -czvf usearch_wasm_linux_"$arch"_${{ steps.set_version.outputs.version }}.tar.gz libusearch_c.so
mv usearch_wasm_linux_"$arch"_${{ steps.set_version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
done
if: matrix.os == 'ubuntu-22.04'
- name: Build library on MacOS
run: |
export WASI_VERSION=20
export WASI_VERSION_FULL=${WASI_VERSION}.0
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
tar xf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
rm -rf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
export WASI_SDK_PATH=/Users/runner/work/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}
archs=("x86_64" "arm64")
cd ./c
for arch in "${archs[@]}"
do
../wasi-sdk-20.0/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -o libusearch_c.dylib -O3 lib.cpp -I. -I ../include/ -I ../fp16/include/ -shared --target=wasm32-wasi-threads -Wl,--no-entry -nostdlib -D_WASI_EMULATED_MMAN -march="$arch"
zip -r usearch_wasm_macos_"$arch"_${{ steps.set_version.outputs.version }}.zip libusearch_c.dylib
mv usearch_wasm_macos_"$arch"_${{ steps.set_version.outputs.version }}.zip ../ && rm -rf libusearch_c.dylib
done
if: matrix.os == 'macOS-11'
- name: Build library on Windows
run: |
export WASI_VERSION=20
export WASI_VERSION_FULL=${WASI_VERSION}.0
curl -LOJ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
tar xf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
rm -rf wasi-sdk-${WASI_VERSION_FULL}.m-mingw.tar.gz
export WASI_SDK_PATH=/d/a/usearch/usearch/wasi-sdk-${WASI_VERSION_FULL}+m
archs=("x64" "x86")
cd ./c
for arch in "${archs[@]}"
do
../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"
tar -cvf usearch_wasm_windows_"$arch"_${{ steps.set_version.outputs.version }}.tar.gz libusearch_c.so
mv usearch_wasm_windows_"$arch"_${{ steps.set_version.outputs.version }}.tar.gz ../ && rm -rf libusearch_c.so
done
shell: bash
if: matrix.os == 'windows-2022'
- name: Upload archive
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.zip;*.tar.gz"
update_latest_release: true
publish_checksums:
name: Compute Assets Checksums
runs-on: ubuntu-22.04
needs:
[
versioning,
create_linux_deb_package,
create_windows_dll_library,
create_macos_dylib_library,
create_wasm_library,
deploy_docs_pages,
]
steps:
- name: Get last release ID
id: last_release
run: |
response=$(curl -s -H "Authorization: Bearer ${{ secrets.SEMANTIC_RELEASE_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")
echo "last_release_id=$(echo "$response" | jq -r '.id')" >> $GITHUB_OUTPUT
- name: Download release assets
uses: robinraju/[email protected]
with:
latest: true
fileName: "*"
out-file-path: "downloads"
tarBall: true
zipBall: true
- name: Calculate source hashes
id: hashes
run: |
i=1
cd $GITHUB_WORKSPACE/downloads
for asset_name in $(ls); do
asset_hash=$(sha256sum $asset_name | awk '{print $1}')
echo "asset_name_$i=$asset_name" >> $GITHUB_OUTPUT
echo "asset_hash_$i=$asset_hash" >> $GITHUB_OUTPUT
i=$((i+1))
done
- name: Upload hashes to release
uses: irongut/[email protected]
with:
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
id: ${{ steps.last_release.outputs.last_release_id }}
prerelease: false
replacebody: false
body: |
## Hashes
* ${{ steps.hashes.outputs.asset_name_1 }} : `${{ steps.hashes.outputs.asset_hash_1 }}`
* ${{ steps.hashes.outputs.asset_name_2 }} : `${{ steps.hashes.outputs.asset_hash_2 }}`
* ${{ steps.hashes.outputs.asset_name_3 }} : `${{ steps.hashes.outputs.asset_hash_3 }}`
* ${{ steps.hashes.outputs.asset_name_4 }} : `${{ steps.hashes.outputs.asset_hash_4 }}`
* ${{ steps.hashes.outputs.asset_name_5 }} : `${{ steps.hashes.outputs.asset_hash_5 }}`
* ${{ steps.hashes.outputs.asset_name_6 }} : `${{ steps.hashes.outputs.asset_hash_6 }}`
* ${{ steps.hashes.outputs.asset_name_7 }} : `${{ steps.hashes.outputs.asset_hash_7 }}`
* ${{ steps.hashes.outputs.asset_name_8 }} : `${{ steps.hashes.outputs.asset_hash_8 }}`
* ${{ steps.hashes.outputs.asset_name_9 }} : `${{ steps.hashes.outputs.asset_hash_9 }}`
* ${{ steps.hashes.outputs.asset_name_10 }} : `${{ steps.hashes.outputs.asset_hash_10 }}`
* ${{ steps.hashes.outputs.asset_name_11 }} : `${{ steps.hashes.outputs.asset_hash_11 }}`
* ${{ steps.hashes.outputs.asset_name_12 }} : `${{ steps.hashes.outputs.asset_hash_12 }}`
* ${{ steps.hashes.outputs.asset_name_13 }} : `${{ steps.hashes.outputs.asset_hash_13 }}`
* ${{ steps.hashes.outputs.asset_name_14 }} : `${{ steps.hashes.outputs.asset_hash_14 }}`
* ${{ steps.hashes.outputs.asset_name_15 }} : `${{ steps.hashes.outputs.asset_hash_15 }}`
build_wheels:
name: Build Python Wheels
runs-on: ${{ matrix.os }}
needs: versioning
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["37", "38", "39", "310", "311", "312"]
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Setup Docker
if: matrix.os == 'ubuntu-22.04'
uses: crazy-max/[email protected]
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Setup QEMU
if: matrix.os == 'ubuntu-latest' # We only need QEMU for Linux builds
uses: docker/setup-qemu-action@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
overwrite: true
publish_python:
name: Publish Python
needs: build_wheels
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/usearch
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
verbose: true
print-hash: true
build_javascript:
name: Build JavaScript Native Modules
needs: versioning
strategy:
fail-fast: false
matrix:
arch:
- x64
- x86
os:
- macos-latest
- ubuntu-22.04
# Windows pre-buld is not working
# - windows-latest
exclude:
- arch: x86
os: macos-latest
- arch: x86
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
env:
CC: gcc-12
CXX: g++-12
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
ref: "main"
- run: git submodule update --init --recursive
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ matrix.arch }}
- name: Update compilers
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt update
sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12
sudo apt install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
- run: npm ci --ignore-scripts
- run: npm run prebuild-single
if: matrix.os != 'macos-latest'
- run: npm run prebuild-darwin-x64+arm64
env:
CC: clang
CXX: clang++
if: matrix.os == 'macos-latest'
- run: file prebuilds/*/*
if: matrix.os == 'macos-latest'
- name: Extra for cross build
if: matrix.os == 'ubuntu-22.04'
run: |
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
export AR=aarch64-linux-gnu-ar
export AS=aarch64-linux-gnu-as
export LD=aarch64-linux-gnu-ld
export STRIP=aarch64-linux-gnu-strip
npm run prebuild-arm64
aarch64-linux-gnu-strip prebuilds/linux-arm64/*node
- uses: actions/upload-artifact@v3
with:
name: prebuilds
path: prebuilds
retention-days: 1
publish_javascript:
name: Publish JavaScript
needs: build_javascript
runs-on: ubuntu-22.04
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download prebuilds
uses: actions/download-artifact@v3
- name: Look for links
run: find . -type f -links +1
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: Build the JS from TS
run: npm run build-js
- name: Last minute test with prebuild artifact
run: npm run test
- name: Publish Dry Run
run: npm publish --dry-run
- name: Publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
publish_rust:
name: Publish Rust
needs: versioning
runs-on: ubuntu-24.04
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Hide submodule Crates
run: |
mv simsimd/Cargo.toml simsimd/Cargo.toml.bak
mv stringzilla/Cargo.toml stringzilla/Cargo.toml.bak
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish_java:
name: Publish Java
needs: versioning
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/[email protected]
- name: Execute Gradle build
run: gradle sign && gradle build
- name: Publish package
run: gradle publish
publish_swift:
name: Publish ObjC & Swift
needs: versioning
runs-on: macos-12
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Build
run: swift build
- name: Run tests
run: swift test
# Publishes to both Docker Hub and GitHub Container Registry
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub-and-github-packages
publish_docker:
name: Publish Docker Image
needs: versioning
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract tags & labels for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
unum/usearch
ghcr.io/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build_csharp:
name: Build C Dependencies for C#
needs: versioning
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Build C library for Linux
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt update
sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12
export CC=gcc-12
export CXX=g++-12
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
cmake --build build_artifacts --config Release
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
cp "${{ github.workspace }}/build_artifacts/libusearch_c.so" "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
- name: Build C library for MacOS
if: matrix.os == 'macos-12'
run: |
brew update
brew install cmake
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
cmake --build build_artifacts --config Release
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
- name: Build C library for Windows
if: matrix.os == 'windows-2022'
run: |
choco install cmake
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
cmake --build build_artifacts --config Release
mkdir -p "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
cp "${{ github.workspace }}\build_artifacts\libusearch_c.dll" "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: usearch-csharp-dependencies
path: ${{ github.workspace }}/csharp/lib/**/*
publish_csharp:
name: Publish C#
runs-on: ubuntu-22.04
needs: [build_csharp]
env:
SOLUTION: ${{ github.workspace }}/csharp
USEARCH_LIBS: ${{ github.workspace }}/csharp/lib
NUGET_PACKAGES: ${{ github.workspace }}/csharp/packages
# NUGET_SOURCE: https://apiint.nugettest.org/v3/index.json
NUGET_SOURCE: https://api.nuget.org/v3/index.json
GITHUB_PACKAGES_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
steps:
- name: Check out refreshed version
uses: actions/checkout@v4
with:
ref: "main"
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Download usearch libs artifact
uses: actions/download-artifact@v3
with:
name: usearch-csharp-dependencies
path: ${{ env.USEARCH_LIBS }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Pack project
run: |
dotnet pack "${{ env.SOLUTION }}" -c Release --output ${{ env.NUGET_PACKAGES }}
working-directory: ${{ github.workspace }}
- name: Publish to NuGet
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.NUGET_API }}" --source "${{ env.NUGET_SOURCE }}" --skip-duplicate
- name: Prepare publish to GitHub Registry
run: dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "${{ env.GITHUB_PACKAGES_SOURCE }}"
- name: Publish to GitHub Registry
run: dotnet nuget push "${{ env.NUGET_PACKAGES }}/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source "github" --skip-duplicate
build_docs:
name: Build Docs
runs-on: ubuntu-22.04
if: ${{ always() }}
needs:
[
publish_python,
publish_javascript,
publish_rust,
publish_java,
publish_swift,
publish_docker,
publish_csharp,
]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"
- name: Install dependencies
run: |
sudo apt update &&
sudo apt install -y doxygen graphviz dia git &&
pip install -r docs/requirements.txt &&
npm install -g jsdoc typedoc
- name: Install USearch from PyPi
run: pip install usearch
- name: Build CJS JS
run: |
npm ci --ignore-scripts
npm run build-js
- name: Build documentation
run: cd docs && doxygen conf.dox && make html
- name: Copy assets
run: cp -r assets build/docs/html/
- name: Compress assets
run: tar -czvf docs.tar.gz build/docs/html/
- name: Upload docs to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: docs.tar.gz
update_latest_release: true
deploy_docs_pages:
name: Deploy GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
if: ${{ always() }}
needs: build_docs
steps:
- uses: robinraju/[email protected]
with:
latest: true
fileName: docs.tar.gz
- name: Unpack docs
run: tar -xf ./docs.tar.gz
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Upload artifacts
uses: actions/upload-pages-artifact@v1
with:
path: ./build/docs/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
deploy_docs_vercel:
name: Deploy Vercel
runs-on: ubuntu-22.04
if: ${{ always() }}
needs: build_docs
steps:
- name: Notify Vercel
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.DOCS_VERCEL }}
method: "POST"