-
Notifications
You must be signed in to change notification settings - Fork 78
531 lines (479 loc) · 17.9 KB
/
prerelease.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
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.11
SWIFT_VERSION: 5.9
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@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/tinysemver@v2.0.7
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_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/stringzilla/stringzilla.h:^#define STRINGZILLA_VERSION_MINOR (\d+)
update-patch-version-in: |
include/stringzilla/stringzilla.h:^#define STRINGZILLA_VERSION_PATCH (\d+)
dry-run: "true"
test_ubuntu_gcc:
name: Ubuntu (GCC 12)
runs-on: ubuntu-22.04
env:
CC: gcc-12
CXX: g++-12
steps:
- uses: actions/checkout@v4
# 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 libjemalloc-dev libomp-dev 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 "CPU Features:"
lscpu
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 stringzillite is built correctly
run: test -z "$(ldd build_artifacts/libstringzillite.so | grep '.so')"
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_search ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_similarity ${DATASET_PATH} # for edit distances and alignment scores
build_artifacts/stringzilla_bench_sort ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container ${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@v5.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: Test Python
run: pytest scripts/test.py -s -x
# JavaScript
# - name: Set up Node.js
# uses: actions/setup-node
# with:
# node-version: 18
# - name: Build and test JavaScript
# run: npm ci && npm test
# Rust
- name: Test Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
test_ubuntu_clang:
name: Ubuntu (Clang 16)
runs-on: ubuntu-22.04
env:
CC: clang-16
CXX: clang++-16
steps:
- uses: actions/checkout@v4
# 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 "CPU Features:"
lscpu
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 stringzillite is built correctly
run: test -z "$(ldd build_artifacts/libstringzillite.so | grep '.so')"
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_search ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_similarity ${DATASET_PATH} # for edit distances and alignment scores
build_artifacts/stringzilla_bench_sort ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container ${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@v5.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: Test Python
run: pytest scripts/test.py -s -x
# Rust
- name: Test Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# 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@v1
# 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 --enable-test-discovery
# 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:5.9
steps:
- uses: actions/checkout@v4
- name: Test Swift
run: swift test
test_ubuntu_cross_compilation:
name: Clang Cross Compilation
runs-on: ubuntu-22.04
env:
CC: clang-16
CXX: clang++-16
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:
- uses: actions/checkout@v4
# C/C++
# We need to install the cross-compilation toolchain for ARM64 and ARMHF
# 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-get update
sudo apt-get install -y make build-essential crossbuild-essential-arm64 crossbuild-essential-armhf 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 \
-DCMAKE_C_COMPILER_TARGET=${{ matrix.target }} \
-DCMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} \
-DSTRINGZILLA_BUILD_SHARED=1 \
-DSTRINGZILLA_BUILD_BENCHMARK=1 \
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo
# We can't run the produced builds, but we can make sure they exist
- name: Test artifacts presense
run: |
test -e build_artifacts/libstringzillite.so
test -e build_artifacts/libstringzilla_shared.so
test -e build_artifacts/stringzilla_test_cpp20
- name: Check stringzillite is built correctly
run: test -z "$(ldd build_artifacts/libstringzillite.so | grep '.so')"
test_macos:
name: MacOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
# C/C++
- name: Install dependencies
run: |
brew update
brew install 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: Check stringzillite is built correctly
run: test -z "$(ldd build_artifacts/libstringzillite.so | grep '.so')"
- name: Test on Real World Data
run: |
build_artifacts/stringzilla_bench_search ${DATASET_PATH} # for substring search
build_artifacts/stringzilla_bench_token ${DATASET_PATH} # for hashing, equality comparisons, etc.
build_artifacts/stringzilla_bench_similarity ${DATASET_PATH} # for edit distances and alignment scores
build_artifacts/stringzilla_bench_sort ${DATASET_PATH} # for sorting arrays of strings
build_artifacts/stringzilla_bench_container ${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@v5.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: pytest scripts/test.py -s -x
# Swift
- name: Set up Swift ${{ env.SWIFT_VERSION }}
uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Build Swift
run: swift build
- name: Test Swift
run: swift test
# Rust
- name: Test Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
test_windows:
name: Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- 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
echo:
echo "CPU Features:"
wmic cpu list /format:list
exit 1
)
- name: Test C++
run: .\build_artifacts\stringzilla_test_cpp20.exe
- name: Check stringzillite is built correctly
shell: cmd
run: dumpbin /nologo /dependents stringzillite.dll | findstr /r "^[^a-z].*\.dll" && exit /b 1 || exit /b 0
- name: Test on Real World Data
run: |
.\build_artifacts\stringzilla_bench_search.exe ${DATASET_PATH} # for substring search
.\build_artifacts\stringzilla_bench_token.exe ${DATASET_PATH} # for hashing, equality comparisons, etc.
.\build_artifacts\stringzilla_bench_similarity.exe ${DATASET_PATH} # for edit distances and alignment scores
.\build_artifacts\stringzilla_bench_sort.exe ${DATASET_PATH} # for sorting arrays of strings
.\build_artifacts\stringzilla_bench_container.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@v5.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: Test Python
run: pytest scripts/test.py -s -x
test_windows_cross_compilation:
name: Windows Cross Compilation ${{ matrix.target }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x64
target: x64
- arch: x86
target: x86
- arch: amd64_arm64
target: arm64
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build C/C++
shell: cmd
run: |
cmake -GNinja -B build_artifacts ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo ^
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 ^
-DSTRINGZILLA_BUILD_SHARED=1 ^
-DSTRINGZILLA_BUILD_BENCHMARK=1 ^
-DSTRINGZILLA_BUILD_TEST=1
cmake --build build_artifacts --config RelWithDebInfo
# We can't run the produced builds, but we can make sure they exist
- name: Test artifacts presense
shell: cmd
run: |
type build_artifacts\stringzillite.dll >NUL
type build_artifacts\stringzilla_shared.dll >NUL
type build_artifacts\stringzilla_test_cpp20.exe >NUL
- name: Check stringzillite is built correctly
shell: cmd
run: dumpbin /nologo /dependents stringzillite.dll | findstr /r "^[^a-z].*\.dll" && exit /b 1 || exit /b 0
test_alpine:
name: Alpine Linux
runs-on: ubuntu-24.04
container:
image: alpine:latest
options: --privileged # If needed for certain Docker operations
steps:
- uses: actions/checkout@v3
# 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 stringzillite is built correctly
run: test -z "$(ldd build_artifacts/libstringzillite.so | grep '.so')"
# 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.py -s -x
# Rust
- name: Test Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
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_alpine,
]
strategy:
matrix:
os: [ubuntu-24.04, macos-14, windows-2022]
python-version: ["36", "37", "38", "39", "310", "311", "312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.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@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 }}-*