-
Notifications
You must be signed in to change notification settings - Fork 125
817 lines (749 loc) · 33.3 KB
/
prerelease.yml
File metadata and controls
817 lines (749 loc) · 33.3 KB
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
name: "Pre-Release"
on:
push:
branches: ["main-dev"]
pull_request:
branches: ["main-dev"]
env:
BUILD_TYPE: Release
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
PYTHON_VERSION: 3.12
SWIFT_VERSION: 6.0
PYTHONUTF8: 1
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
jobs:
versioning:
name: Update Version
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/tinysemver@v3.0.1
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
Cargo.toml:^version = "(\d+\.\d+\.\d+)"
package.json:"version": "(\d+\.\d+\.\d+)"
CMakeLists.txt:VERSION (\d+\.\d+\.\d+)
update-major-version-in: |
include/stringzilla/stringzilla.h:^#define STRINGZILLA_H_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/stringzilla/stringzilla.h:^#define STRINGZILLA_H_VERSION_MINOR (\d+)
update-patch-version-in: |
include/stringzilla/stringzilla.h:^#define STRINGZILLA_H_VERSION_PATCH (\d+)
dry-run: "true"
test_ubuntu_gcc:
name: Ubuntu (GCC 12) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm]
env:
CC: gcc-12
CXX: g++-12
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
# C/C++
# If the compilation fails, we want to log the compilation commands in addition to
# the standard output.
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-12 g++-12
- name: Build C/C++
run: |
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo > build_artifacts/logs.txt 2>&1 || {
echo "Compilation failed. Here are the logs:"
cat build_artifacts/logs.txt
echo "The original compilation commands:"
cat build_artifacts/compile_commands.json
echo "GCC Version:"
gcc-12 --version
echo "G++ Version:"
g++-12 --version
exit 1
}
- name: Test C++
run: build_artifacts/stringzilla_test_cpp20
- name: Check stringzilla_bare is built correctly
run: test -z "$(ldd build_artifacts/libstringzilla_bare.so | grep '.so')"
- name: Build shared library for Go binding
run: |
cmake -B build_shared -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRINGZILLA_BUILD_SHARED=1
cmake --build build_shared --target stringzilla_shared --config RelWithDebInfo
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ">=1.24"
cache: false
- name: Test Go binding
working-directory: golang
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/build_shared
run: go test -v -tags no_sha256 # Skip SHA tests for GCC
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_memory_cpp20 ${DATASET_PATH} # for string copies and fills
build_artifacts/stringzilla_bench_find_cpp20 ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token_cpp20 ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_sequence_cpp20 ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container_cpp20 ${DATASET_PATH} # for STL containers with string keys
env:
DATASET_PATH: ./README.md
# Don't overload GitHub with our benchmarks.
# The results in such an unstable environment will be meaningless anyway.
if: 0
- name: Test Parallel Algorithms on Real World Data
run: |
build_artifacts/stringzillas_bench_similarities_cpp20 ${DATASET_PATH} # for edit distances and alignment scores
build_artifacts/stringzillas_bench_fingerprints_cpp20 ${DATASET_PATH} # for multi-needle search in many strings
env:
DATASET_PATH: ./README.md
# Don't overload GitHub with our benchmarks.
# The results in such an unstable environment will be meaningless anyway.
if: 0
# Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build Python
run: |
python -m pip install --upgrade pip
pip install pytest pytest-repeat numpy pyarrow
python -m pip install .
- name: Log Python capabilities
run: |
python - << 'PY'
import platform
import stringzilla as sz
print("platform:", platform.platform())
print("machine:", platform.machine(), "processor:", platform.processor())
print("stringzilla.__capabilities__:", sz.__capabilities__)
PY
- name: Test Python
run: python -X faulthandler -m pytest scripts/test_stringzilla.py -s -vv --maxfail=1 --full-trace
# JavaScript
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Build and test JavaScript
run: npm install && npm test
# Rust
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
test_ubuntu_clang:
name: Ubuntu (Clang 16) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm]
env:
CC: clang-16
CXX: clang++-16
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
# C/C++
# Clang 16 isn't available from default repos on Ubuntu 22.04, so we have to install it manually
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential libjemalloc-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16
- name: Build C/C++
run: |
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo > build_artifacts/logs.txt 2>&1 || {
echo "Compilation failed. Here are the logs:"
cat build_artifacts/logs.txt
echo "The original compilation commands:"
cat build_artifacts/compile_commands.json
echo "Clang Version:"
clang-16 --version
echo "Clang++ Version:"
clang++-16 --version
exit 1
}
- name: Test C++
run: build_artifacts/stringzilla_test_cpp20
- name: Check stringzilla_bare is built correctly
run: test -z "$(ldd build_artifacts/libstringzilla_bare.so | grep '.so')"
- name: Build shared library for Go binding
run: |
cmake -B build_shared -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRINGZILLA_BUILD_SHARED=1
cmake --build build_shared --target stringzilla_shared --config RelWithDebInfo
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ">=1.24"
cache: false
- name: Test Go binding
working-directory: golang
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/build_shared
run: go test -v
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_find_cpp20 ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token_cpp20 ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_sequence_cpp20 ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container_cpp20 ${DATASET_PATH} # for STL containers with string keys
env:
DATASET_PATH: ./README.md
# Don't overload GitHub with our benchmarks.
# The results in such an unstable environment will be meaningless anyway.
if: 0
# Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build Python
run: |
python -m pip install --upgrade pip
pip install pytest pytest-repeat numpy pyarrow
python -m pip install .
- name: Log Python capabilities
run: |
python - << 'PY'
import platform
import stringzilla as sz
print("platform:", platform.platform())
print("machine:", platform.machine(), "processor:", platform.processor())
print("stringzilla.__capabilities__:", sz.__capabilities__)
PY
- name: Test Python
run: python -X faulthandler -m pytest scripts/test_stringzilla.py -s -vv --maxfail=1 --full-trace
# Rust
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
# Swift
# Fails due to: https://github.com/swift-actions/setup-swift/issues/591
# - name: Set up Swift ${{ env.SWIFT_VERSION }}
# uses: swift-actions/setup-swift@v2.4.0
# with:
# swift-version: ${{ env.SWIFT_VERSION }}
# - name: Build Swift
# run: swift build -c release --static-swift-stdlib
# - name: Test Swift
# run: swift test -c release
test_ubuntu_cpus:
name: Ubuntu (StringZillas-CPUs)
runs-on: ubuntu-22.04
env:
CC: gcc-12
CXX: g++-12
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
# C/C++
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-12 g++-12
- name: Build C/C++
run: |
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo > build_artifacts/logs.txt 2>&1 || {
echo "Compilation failed. Here are the logs:"
cat build_artifacts/logs.txt
echo "The original compilation commands:"
cat build_artifacts/compile_commands.json
echo "GCC Version:"
gcc-12 --version
echo "G++ Version:"
g++-12 --version
exit 1
}
- name: Test C++
run: build_artifacts/stringzilla_test_cpp20
- name: Check stringzilla_bare is built correctly
run: test -z "$(ldd build_artifacts/libstringzilla_bare.so | grep '.so')"
# Python StringZillas-CPUs
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
# Ensure modern build backend is available for editable installs
- name: Build Python StringZillas-CPUs
run: |
python -m pip install --upgrade pip
pip install "setuptools>=64" wheel
pip install pytest pytest-repeat numpy pyarrow affine-gaps
SZ_TARGET=stringzilla pip install -e . --force-reinstall --no-build-isolation
SZ_TARGET=stringzillas-cpus pip install -e . --force-reinstall --no-build-isolation
- name: Log Python capabilities
run: |
python - << 'PY'
import platform
import stringzilla as sz
import stringzillas as szs
print("platform:", platform.platform())
print("machine:", platform.machine(), "processor:", platform.processor())
print("stringzilla.__capabilities__:", sz.__capabilities__)
print("stringzillas.__capabilities__:", szs.__capabilities__)
PY
- name: Test Python StringZillas-CPUs
run: python -X faulthandler -m pytest scripts/test_stringzillas.py -s -vv --maxfail=1 --full-trace
test_ubuntu_cuda:
name: Ubuntu (StringZillas-CUDA)
runs-on: ubuntu-22.04
env:
CC: gcc-12
CXX: g++-12
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
# Install CUDA Toolkit
- name: Install CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.35
with:
cuda: "12.9.1"
method: "network"
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo ""
echo "GPU Info:"
nvcc --version 2>/dev/null || echo "nvcc not yet installed"
nvidia-smi 2>/dev/null || echo "nvidia-smi not yet available"
echo "────────────────────────────────────────────────────────────────"
# C/C++
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-12 g++-12
- name: Build C/C++ with CUDA
run: |
# Note: Using Release build type instead of RelWithDebInfo
# Optimized debugging not supported in CUDA and results in PTXAS fatal errors
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config Release > build_artifacts/logs.txt 2>&1 || {
echo "Compilation failed. Here are the logs:"
cat build_artifacts/logs.txt
echo "The original compilation commands:"
cat build_artifacts/compile_commands.json
echo "CUDA Version:"
nvcc --version
echo "GCC Version:"
gcc-12 --version
echo "G++ Version:"
g++-12 --version
exit 1
}
- name: Test C++
run: build_artifacts/stringzilla_test_cpp20
- name: Check stringzilla_bare is built correctly
run: test -z "$(ldd build_artifacts/libstringzilla_bare.so | grep '.so')"
# Python StringZillas-CUDA
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
# Ensure modern build backend is available for editable installs
- name: Build Python StringZillas-CUDA
run: |
python -m pip install --upgrade pip
pip install "setuptools>=64" wheel
pip install pytest pytest-repeat numpy pyarrow wheel affine-gaps
SZ_TARGET=stringzilla pip install -e . --force-reinstall --no-build-isolation
SZ_TARGET=stringzillas-cuda pip install -e . --force-reinstall --no-build-isolation
- name: Log Python capabilities
run: |
python - << 'PY'
import platform
import stringzilla as sz
import stringzillas as szs
print("platform:", platform.platform())
print("machine:", platform.machine(), "processor:", platform.processor())
print("stringzilla.__capabilities__:", sz.__capabilities__)
print("stringzillas.__capabilities__:", szs.__capabilities__)
PY
- name: Test Python StringZillas-CUDA
run: python -X faulthandler -m pytest scripts/test_stringzillas.py -s -vv --maxfail=1 --full-trace
# Temporary workaround to run Swift tests on Linux
# Based on: https://github.com/swift-actions/setup-swift/issues/591#issuecomment-1685710678
test_ubuntu_swift:
name: Swift on Linux
runs-on: ubuntu-22.04
container: swift:latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu || true
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
- name: Test Swift
run: swift test
test_cross_linux:
name: Cross Compile (${{ matrix.arch }} → ${{ matrix.target_arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
arch: x86-64
target_arch: aarch64
target: aarch64-linux-gnu
target_processor: arm64
- os: ubuntu-22.04-arm
arch: aarch64
target_arch: x86-64
target: x86_64-linux-gnu
target_processor: amd64
env:
CC: clang-16
CXX: clang++-16
AR: llvm-ar-16
NM: llvm-nm-16
RANLIB: llvm-ranlib-16
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Cross-Compilation: ${{ matrix.arch }} → ${{ matrix.target_arch }}"
echo "────────────────────────────────────────────────────────────────"
lscpu
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
- name: Install cross-compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y make build-essential crossbuild-essential-${{ matrix.target_processor }}
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16
- name: Build C/C++ for ${{ matrix.target_arch }}
run: |
# Configure and build the project
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-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.target_processor }} \
-DSTRINGZILLA_BUILD_SHARED=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo
- name: Verify ${{ matrix.target_arch }} binaries
run: |
# We can't run ${{ matrix.target_arch }} binaries on ${{ matrix.arch }}, but we can verify they exist and are ${{ matrix.target_arch }}
test -e build_artifacts/libstringzilla_bare.so
test -e build_artifacts/libstringzilla_shared.so
test -e build_artifacts/stringzilla_test_cpp20
file build_artifacts/stringzilla_test_cpp20 | grep -q "${{ matrix.target_arch }}"
echo "✓ ${{ matrix.target_arch }} binaries built successfully"
test_macos:
name: MacOS
runs-on: macos-14
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
sysctl -a | grep machdep.cpu || true
echo ""
echo "System Info:"
system_profiler SPHardwareDataType || true
echo "────────────────────────────────────────────────────────────────"
# C/C++
- name: Install dependencies
run: |
brew update
brew reinstall cmake
- name: Build C/C++
run: |
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: build_artifacts/stringzilla_test_cpp17
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_find_cpp20 ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token_cpp20 ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_sequence_cpp20 ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container_cpp20 ${DATASET_PATH} # for STL containers with string keys
env:
DATASET_PATH: ./README.md
# Don't overload GitHub with our benchmarks.
# The results in such an unstable environment will be meaningless anyway.
if: 0
# Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build Python
run: |
python -m pip install --upgrade pip
pip install pytest pytest-repeat numpy pyarrow
python -m pip install .
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
- name: Test Python
run: python -X faulthandler -m pytest scripts/test_stringzilla.py -s -vv --maxfail=1 --full-trace
# Swift
- name: Set up Swift ${{ env.SWIFT_VERSION }}
uses: swift-actions/setup-swift@v2.4.0
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Build Swift
run: swift build
- name: Test Swift
run: swift test
# Rust
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
test_windows:
name: Windows - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
arch: x64
- os: windows-11-arm
arch: arm64
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Log hardware capabilities
shell: powershell
run: |
Write-Host "────────────────────────────────────────────────────────────────"
Write-Host "Hardware Capabilities"
Write-Host "────────────────────────────────────────────────────────────────"
Get-CimInstance -ClassName Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed | Format-List
Write-Host "────────────────────────────────────────────────────────────────"
- name: Build C/C++
shell: cmd
run: |
cmake -GNinja -B build_artifacts ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo ^
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 ^
-DSTRINGZILLA_BUILD_BENCHMARK=1 ^
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo > build_artifacts/logs.txt 2>&1 || (
echo "Compilation failed. Here are the logs:"
type build_artifacts\logs.txt
echo "The original compilation commands:"
type build_artifacts\compile_commands.json
exit 1
)
- name: Test C++
run: .\build_artifacts\stringzilla_test_cpp20.exe
- name: Check stringzilla_bare is built correctly
shell: cmd
run: dumpbin /nologo /dependents .\build_artifacts\stringzilla_bare.dll | findstr /r "[a-zA-Z0-9]\.dll" | findstr /r /v "KERNEL32.dll stringzilla" && exit /b 1 || exit /b 0
- name: Test on Real World Data
run: |
.\build_artifacts\stringzilla_bench_find_cpp20.exe ${DATASET_PATH} # for substring search
.\build_artifacts\stringzilla_bench_token_cpp20.exe ${DATASET_PATH} # for hashing, equality comparisons, etc.
.\build_artifacts\stringzilla_bench_sequence_cpp20.exe ${DATASET_PATH} # for sorting arrays of strings
.\build_artifacts\stringzilla_bench_container_cpp20.exe ${DATASET_PATH} # for STL containers with string keys
env:
DATASET_PATH: ./README.md
# Don't overload GitHub with our benchmarks.
# The results in such an unstable environment will be meaningless anyway.
if: 0
# Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build Python
run: |
python -m pip install --upgrade pip
pip install pytest pytest-repeat numpy
python -m pip install .
- name: Test Python
run: python -X faulthandler -m pytest scripts/test_stringzilla.py -s -vv --maxfail=1 --full-trace
test_alpine:
name: Alpine Linux
runs-on: ubuntu-24.04
container:
image: alpine:latest
options: --privileged # If needed for certain Docker operations
steps:
# bash and curl are required by dtolnay/rust-toolchain
- name: Install Git for checkout
run: |
apk add --no-cache git openssh ca-certificates bash curl
git --version
- name: Log Alpine and Git versions
run: |
echo "Alpine: $(cat /etc/alpine-release 2>/dev/null || echo 'unknown')"
git --version || echo "git not installed"
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Log hardware capabilities
run: |
echo "────────────────────────────────────────────────────────────────"
echo "Hardware Capabilities"
echo "────────────────────────────────────────────────────────────────"
lscpu || true
echo ""
echo "CPU Info:"
grep -E "model name|flags" /proc/cpuinfo | head -5 || true
echo "────────────────────────────────────────────────────────────────"
# C/C++
- name: Build C/C++
run: |
apk add --update make cmake g++ gcc
cmake -B build_artifacts \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: build_artifacts/stringzilla_test_cpp20
- name: Check stringzilla_bare is built correctly
run: test -z "$(ldd build_artifacts/libstringzilla_bare.so | grep '.so' | grep '=>')"
# Python
- name: Build Python
run: |
apk add python3 py3-pip python3-dev
pip install --break-system-packages pytest pytest-repeat
pip install --break-system-packages .
- name: Test Python
run: pytest scripts/test_stringzilla.py -s -x
# Rust
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
build_wheels:
name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
[
test_ubuntu_gcc,
test_ubuntu_clang,
test_macos,
test_windows,
test_cross_linux,
]
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2022]
python-version: ["38", "39", "310", "311", "312", "313"]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
python-version: 3.x
# We only need QEMU for Linux builds
- name: Setup QEMU
if: matrix.os == 'ubuntu-24.04'
uses: docker/setup-qemu-action@v4
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.4.1
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
CIBW_ENVIRONMENT_LINUX: SZ_IS_QEMU_=1 # When emulating this will disable some tricky SIMD instructions