vey-mimalloc-sys 0.3.0+3.5.3

Rust FFI binding to mimalloc
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
on:
  workflow_dispatch:   # allow running the workflow manually
  push:
    branches:
      - 'dev*'
    tags:
      - 'v*'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true # Cancel any in-progress runs of this workflow when a new run is triggered on the same ref (branch or tag)

name: Test
jobs:
  build:
    name: Test
    runs-on: ${{ matrix.os }}
    env:
      MIMALLOC_SHOW_ERRORS: 1
    continue-on-error: 
      ${{ startsWith(matrix.tests,'alpine') || false }}
    strategy:
      fail-fast: false
      matrix:
        tests: [basic,extra]
        os: [windows-latest, macos-latest, ubuntu-latest, macos-14, macos-15-intel, ubuntu-22.04-arm, windows-11-arm]
        c_or_cxx: [c, cxx]
        exclude:
          - os: macos-14
            tests: extra
          - c_or_cxx: cxx
            tests: extra                       
        include:
          - os: ubuntu-latest
            tests: tsan
          - os: ubuntu-latest
            tests: freebsd-x64
          - os: ubuntu-latest
            tests: alpine-x64
          - os: ubuntu-latest
            tests: alpine-riscv64   # qemu
          - os: ubuntu-latest
            tests: alpine-arm32     # qemu
          - os: windows-latest
            tests: mingw-ucrt64
          - os: windows-latest      # clang-cl and clang
            tests: clang
          - os: windows-11-arm      # clang-cl and clang
            tests: clang  
          # - os: ubuntu-latest
          #   tests: android-x64
          # - os: ubuntu-latest       # slow, so disable by default
          #   tests: freebsd-arm64    # qemu

    steps:
      # Checkout: https://github.com/actions/checkout
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      # Choose MI_USE_CXX setting
      - name: Set default cmake options
        id: cmake_args
        shell: bash
        run: |
          if [ "${{ matrix.c_or_cxx }}" = "cxx" ]; then
            echo "CMAKE_CXX_OPT_DEFAULT=-DMI_USE_CXX=ON"  >> $GITHUB_OUTPUT
          else # Default to C mode
            echo "CMAKE_CXX_OPT_DEFAULT=-DMI_USE_CXX=OFF" >> $GITHUB_OUTPUT
          fi          

      # Basic
      - name: Release
        if: matrix.tests == 'basic'
        run: |
          cmake . -B out/release-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_DEFAULT }}
          cmake --build out/release-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/release-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      - name: Release, Asm
        if: matrix.tests == 'basic' && runner.os == 'Linux' && matrix.c_or_cxx == 'c'
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: ${{ matrix.os }}-${{ matrix.c_or_cxx }}-asm
          path: out/release-${{ matrix.c_or_cxx }}/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Debug
        if: matrix.tests == 'basic'
        run: |
          env
          cmake . -B out/debug-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_DEFAULT }}
          cmake --build out/debug-${{ matrix.c_or_cxx }} --parallel 4 --config Debug
          ctest --test-dir out/debug-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Debug

      - name: Secure
        if: matrix.tests == 'basic'
        run: |
          cmake . -B out/secure-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_DEFAULT }}
          cmake --build out/secure-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/secure-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      # Extra Windows: x86, clang-cl, and clang
      - name: Debug, Win32
        if: matrix.tests == 'basic' && runner.os == 'Windows'
        run: |
          cmake . -B out/debug-x86-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Debug -A Win32 ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/debug-x86-${{ matrix.c_or_cxx }} --parallel 4 --config Debug
          ctest --test-dir out/debug-x86-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Debug

      - name: Release, Win32
        if: matrix.tests == 'basic' && runner.os == 'Windows'
        run: |
          cmake . -B out/release-x86-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -A Win32 ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/release-x86-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/release-x86-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      - name: Debug, Win32, clang-cl
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/debug-x86-clang-cl-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Debug -A Win32 -T ClangCl ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/debug-x86-clang-cl-${{ matrix.c_or_cxx }} --parallel 4 --config Debug
          ctest --test-dir out/debug-x86-clang-cl-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Debug

      - name: Release, Win32, clang-cl
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/release-x86-clang-cl-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -A Win32 -T ClangCl ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/release-x86-clang-cl-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/release-x86-clang-cl-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      - name: Debug, Windows, clang-cl
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/debug-clang-cl-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Debug -T ClangCl ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/debug-clang-cl-${{ matrix.c_or_cxx }} --parallel 4 --config Debug
          ctest --test-dir out/debug-clang-cl-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Debug

      - name: Release, Windows, clang-cl
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/release-clang-cl-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -T ClangCl ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/release-clang-cl-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/release-clang-cl-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      - name: Debug, Windows, clang
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/debug-clang-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/debug-clang-${{ matrix.c_or_cxx }} --parallel 4 --config Debug
          ctest --test-dir out/debug-clang-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Debug

      - name: Release, Windows, clang
        if: matrix.tests == 'clang' && runner.os == 'Windows'
        run: |
          cmake . -B out/release-clang-${{ matrix.c_or_cxx }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang ${{ steps.cmake_args.outputs.CMAKE_CXX_OPT_MSVC }}
          cmake --build out/release-clang-${{ matrix.c_or_cxx }} --parallel 4 --config Release
          ctest --test-dir out/release-clang-${{ matrix.c_or_cxx }} --verbose --timeout 240 -C Release

      # Extra, macOS fixed TLS
      - name: Debug, macOS, TLS fixed
        if: matrix.tests == 'extra' && runner.os == 'macOS'
        run: |
          cmake . -B out/debug-tls-fixed -DCMAKE_BUILD_TYPE=Debug -DMI_TLS_MODEL_FIXED=ON
          cmake --build out/debug-tls-fixed --parallel 4 --config Debug
          ctest --test-dir out/debug-tls-fixed --verbose --timeout 240 -C Debug

      - name: Release, macOS, TLS fixed
        if: matrix.tests == 'extra' && runner.os == 'macOS'
        run: |
          cmake . -B out/release-tls-fixed -DCMAKE_BUILD_TYPE=Release -DMI_TLS_MODEL_FIXED=ON
          cmake --build out/release-tls-fixed --parallel 4 --config Release
          ctest --test-dir out/release-tls-fixed --verbose --timeout 240 -C Release

      # Extra, Linux pthread TLS
      - name: Debug, Linux, TLS pthreads
        if: matrix.tests == 'extra' && runner.os == 'linux'
        run: |
          cmake . -B out/debug-tls-pthreads -DCMAKE_BUILD_TYPE=Debug -DMI_TLS_MODEL_PTHREADS=ON
          cmake --build out/debug-tls-pthreads --parallel 4 --config Debug
          ctest --test-dir out/debug-tls-pthreads --verbose --timeout 240 -C Debug

      - name: Release, Linux, TLS pthreads
        if: matrix.tests == 'extra' && runner.os == 'linux'
        run: |
          cmake . -B out/release-tls-pthreads -DCMAKE_BUILD_TYPE=Release -DMI_TLS_MODEL_PTHREADS=ON -DMI_SEE_ASM=ON 
          cmake --build out/release-tls-pthreads --parallel 4 --config Release
          ctest --test-dir out/release-tls-pthreads --verbose --timeout 240 -C Release

      # Extra
      - name: Release, SIMD
        if: matrix.tests == 'extra'
        run: |
          cmake . -B out/release-simd -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON 
          cmake --build out/release-simd --parallel 8 --config Release
          ctest --test-dir out/release-simd --verbose --timeout 240 -C Release

      - name: Debug, C++, clang++
        if: matrix.tests == 'extra' && runner.os == 'Linux' 
        run: |
          CC=clang CXX=clang++ cmake . -B out/debug-clang-cxx -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_USE_CXX=ON
          cmake --build out/debug-clang-cxx --parallel 8 --config Debug
          ctest --test-dir out/debug-clang-cxx --verbose --timeout 240 -C Debug

      - name: Release, C++, clang++
        if: matrix.tests == 'extra' && runner.os == 'Linux' 
        run: |
          CC=clang CXX=clang++ cmake . -B out/release-clang-cxx -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_USE_CXX=ON -DMI_SEE_ASM=ON
          cmake --build out/release-clang-cxx --parallel 8 --config Release
          ctest --test-dir out/release-clang-cxx --verbose --timeout 240 -C Release

      - name: Release, C++, clang++, Asm
        if: matrix.tests == 'extra' && runner.os == 'Linux' 
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: ${{ matrix.os }}-clang-cxx-asm
          path: out/release-clang-cxx/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Debug, ASAN
        if: matrix.tests == 'extra' && runner.os == 'Linux'
        run: |
          CC=clang CXX=clang++ cmake . -B out/debug-asan -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_TRACK=ASAN 
          cmake --build out/debug-asan --parallel 8 --config Debug
          ctest --test-dir out/debug-asan --verbose --timeout 240 -C Debug

      - name: Debug, UBSAN
        if: matrix.tests == 'extra' && runner.os == 'Linux' 
        run: |
          CC=clang CXX=clang++ cmake . -B out/debug-ubsan-cxx -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_DEBUG_UBSAN=ON 
          cmake --build out/debug-ubsan-cxx --parallel 8 --config Debug
          ctest --test-dir out/debug-ubsan-cxx --verbose --timeout 240 -C Debug

      - name: Debug, TSAN
        if: matrix.tests == 'tsan' && runner.os == 'Linux'
        run: |
          CC=clang CXX=clang++ cmake . -B out/debug-tsan -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_DEBUG_TSAN=ON 
          cmake --build out/debug-tsan --parallel 8 --config Debug
          ctest --test-dir out/debug-tsan --verbose --timeout 240 -C Debug

      - name: Debug, Guarded
        if: matrix.tests == 'extra' && runner.os != 'macOS'
        run: |
          cmake . -B out/debug-guarded -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_GUARDED=FULL
          cmake --build out/debug-guarded --parallel 8 --config Debug
          ctest --test-dir out/debug-guarded --verbose --timeout 240 -C Debug
        env:
          MIMALLOC_GUARDED_SAMPLE_RATE: 1024

      - name: Release, Guarded
        if: matrix.tests == 'extra' && runner.os == 'Linux' && startsWith(github.ref_name,'dev3')
        run: |
          cmake . -B out/release-guarded -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_GUARDED=FULL
          cmake --build out/release-guarded --parallel 8 --config Release
          ctest --test-dir out/release-guarded --verbose --timeout 240 -C Release
        env:
          MIMALLOC_GUARDED_SAMPLE_RATE: 128

      - name: Debug, Use pagemap
        if: matrix.tests == 'extra' && runner.os == 'Linux' && startsWith(github.ref_name,'dev3')
        run: |
          cmake . -B out/debug-guarded -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_FREE_USE_PAGEMAP=ON 
          cmake --build out/debug-guarded --parallel 8 --config Debug
          ctest --test-dir out/debug-guarded --verbose --timeout 240 -C Debug

      - name: Release, Use pagemap
        if: matrix.tests == 'extra' && runner.os == 'Linux' && startsWith(github.ref_name,'dev3')
        run: |
          cmake . -B out/release-guarded -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_FREE_USE_PAGEMAP=ON
          cmake --build out/release-guarded --parallel 8 --config Release
          ctest --test-dir out/release-guarded --verbose --timeout 240 -C Release

      - name: Debug, Secure Full
        if: matrix.tests == 'extra' && runner.os != 'macOS'
        run: |
          cmake . -B out/debug-secure-full -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL -DMI_SECURE=FULL 
          cmake --build out/debug-secure-full --parallel 8 --config Debug
          ctest --test-dir out/debug-secure-full --verbose --timeout 240 -C Debug

      - name: Release, Secure Full
        if: matrix.tests == 'extra' && runner.os != 'macOS'
        run: |
          cmake . -B out/release-secure-full -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_SECURE=FULL
          cmake --build out/release-secure-full --parallel 8 --config Release
          ctest --test-dir out/release-secure-full --verbose --timeout 240 -C Release

      # MSYS2 mingw64
      - name: mingw-ucrt64 x64, Setup
        if: matrix.tests == 'mingw-ucrt64'
        uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0     
        with: 
          msystem: UCRT64
          install: |
            mingw-w64-ucrt-x86_64-gcc
            mingw-w64-ucrt-x86_64-git
            mingw-w64-ucrt-x86_64-make
            mingw-w64-ucrt-x86_64-cmake

      - name: mingw-ucrt64 x64, Debug
        if: matrix.tests == 'mingw-ucrt64'
        shell: msys2 {0}
        run: |
          env
          cmake . -B out/debug-mingw-ucrt64-x64 -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL
          cmake --build out/debug-mingw-ucrt64-x64 --parallel 4 --config Debug
          ctest --test-dir out/debug-mingw-ucrt64-x64 --verbose --timeout 240 -C Debug

      - name: mingw-ucrt64 x64, Release
        if: matrix.tests == 'mingw-ucrt64'
        shell: msys2 {0}
        run: |
          cmake . -B out/release-mingw-ucrt64-x64 -DCMAKE_BUILD_TYPE=Release  -DMI_OPT_ARCH=ON
          cmake --build out/release-mingw-ucrt64-x64 --parallel 4 --config Release
          ctest --test-dir out/release-mingw-ucrt64-x64 --verbose --timeout 240 -C Release


      # VM: FreeBSD (arm64 and x64)
      - name: FreeBSD arm64, Setup
        if: matrix.tests == 'freebsd-arm64'
        uses: vmactions/freebsd-vm@f0552d3b69211736abd97f02ff3d4674c56b73b1 # v1.5.5
        with:
          arch: arm64
          custom-shell-name: freebsd-arm64
          cache-after-prepare: true
          prepare: |
            uname -a
            pkg install -y cmake

      - name: FreeBSD arm64, Debug
        if: matrix.tests == 'freebsd-arm64'
        shell: freebsd-arm64 {0}
        run: |
          export MI_TEST_LIGHT=1
          cmake . -B out/debug-arm64 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL 
          cmake --build out/debug-arm64 --parallel 4 --config Debug
          ctest --test-dir out/debug-arm64 --verbose --timeout 240 -C Debug

      - name: FreeBSD arm64, Release
        if: matrix.tests == 'freebsd-arm64'
        shell: freebsd-arm64 {0}
        run: |
          export MI_TEST_LIGHT=1
          cmake . -B out/release-arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release  -DMI_OPT_ARCH=ON 
          cmake --build out/release-arm64 --parallel 4 --config Release
          ctest --test-dir out/release-arm64 --verbose --timeout 240 -C Release

      - name: FreeBSD arm64, Secure
        if: matrix.tests == 'freebsd-arm64'
        shell: freebsd-arm64 {0}
        run: |
          export MI_TEST_LIGHT=1
          cmake . -B out/secure-arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON 
          cmake --build out/secure-arm64 --parallel 4 --config Release
          ctest --test-dir out/secure-arm64 --verbose --timeout 240 -C Release


      - name: FreeBSD x64, Setup
        if: matrix.tests == 'freebsd-x64'
        uses: vmactions/freebsd-vm@f0552d3b69211736abd97f02ff3d4674c56b73b1 # v1.5.5
        with:
          arch: x86_64
          usesh: true
          custom-shell-name: freebsd-x64
          cache-after-prepare: true
          prepare: |
            pkg install -y cmake

      - name: FreeBSD x64, Debug
        if: matrix.tests == 'freebsd-x64'
        shell: freebsd-x64 {0}
        run: |
          cmake . -B out/debug-x64 -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL 
          cmake --build out/debug-x64 --parallel 4 --config Debug
          ctest --test-dir out/debug-x64 --verbose --timeout 240 -C Debug

      - name: FreeBSD x64, Release
        if: matrix.tests == 'freebsd-x64'
        shell: freebsd-x64 {0}
        run: |
          cmake . -B out/release-x64 -DCMAKE_BUILD_TYPE=Release  -DMI_OPT_ARCH=ON 
          cmake --build out/release-x64 --parallel 4 --config Release
          ctest --test-dir out/release-x64 --verbose --timeout 240 -C Release

      - name: FreeBSD x64, Secure
        if: matrix.tests == 'freebsd-x64'
        shell: freebsd-x64 {0}
        run: |
          cmake . -B out/secure-x64 -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON 
          cmake --build out/secure-x64 --parallel 4 --config Release
          ctest --test-dir out/secure-x64 --verbose --timeout 240 -C Release


      # VM: Alpine Linux with MUSL libc (riscv64, x64, and arm32)
      - name: Alpine riscv64, Setup
        if: matrix.tests == 'alpine-riscv64'
        uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
        with:
          arch: riscv64
          shell-name: alpine-riscv64.sh
          apk-tools-url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v3.0.7/x86_64/apk.static#!sha256!c07bf5356eacc9dd7a8c56bc537f46702f007170287403299d52a04264e74b3c
          packages: |
            build-base
            cmake
            ninja
            clang

      - name: Alpine riscv64, Release clang
        if: matrix.tests == 'alpine-riscv64'
        shell: alpine-riscv64.sh {0}
        run: |
          CC=clang CXX=clang++ cmake . -B out/release-riscv64-clang -G Ninja -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=rv64gcb_zacas_zalasr -DMI_SEE_ASM=ON 
          cmake --build out/release-riscv64-clang --parallel 4 --config Release
          ctest --test-dir out/release-riscv64-clang --verbose --timeout 240 -C Release

      - name: Alpine risc64, Asm clang
        if: matrix.tests == 'alpine-riscv64'
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: alpine-riscv64-clang-asm
          path: out/release-riscv64-clang/CMakeFiles/mimalloc-static.dir/src/*.s
                      
      - name: Alpine riscv64, Release
        if: matrix.tests == 'alpine-riscv64'
        shell: alpine-riscv64.sh {0}
        run: |
          cmake . -B out/release-riscv64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON 
          cmake --build out/release-riscv64 --parallel 4 --config Release
          ctest --test-dir out/release-riscv64 --verbose --timeout 240 -C Release

      - name: Alpine risc64, Asm
        if: matrix.tests == 'alpine-riscv64'
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: alpine-riscv64-asm
          path: out/release-riscv64/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Alpine riscv64, Debug
        if: matrix.tests == 'alpine-riscv64'
        shell: alpine-riscv64.sh {0}
        env:
          MI_TEST_LIGHT: 1
        run: |
          uname -m
          cmake . -B out/debug-riscv64 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL 
          cmake --build out/debug-riscv64 --parallel 4 --config Debug
          ctest --test-dir out/debug-riscv64 --verbose --timeout 240 -C Debug

      - name: Alpine riscv64, Secure
        if: matrix.tests == 'alpine-riscv64'
        shell: alpine-riscv64.sh {0}
        run: |
          cmake . -B out/secure-riscv64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON 
          cmake --build out/secure-riscv64 --parallel 4 --config Release
          ctest --test-dir out/secure-riscv64 --verbose --timeout 240 -C Release

      - name: Alpine x64, Setup
        if: matrix.tests == 'alpine-x64'
        uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
        with:
          arch: x86_64
          shell-name: alpine-x64.sh
          packages: |
            build-base
            cmake

      - name: Alpine x64, Debug
        if: matrix.tests == 'alpine-x64'
        shell: alpine-x64.sh {0}
        run: |
          cmake . -B out/debug-x64 -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL 
          cmake --build out/debug-x64 --parallel 4 --config Debug
          ctest --test-dir out/debug-x64 --verbose --timeout 240 -C Debug

      - name: Alpine x64, Release
        if: matrix.tests == 'alpine-x64'
        shell: alpine-x64.sh {0}
        run: |
          cmake . -B out/release-x64 -DCMAKE_BUILD_TYPE=Release  -DMI_OPT_ARCH=ON 
          cmake --build out/release-x64 --parallel 4 --config Release
          ctest --test-dir out/release-x64 --verbose --timeout 240 -C Release

      - name: Alpine x64, Secure
        if: matrix.tests == 'alpine-x64'
        shell: alpine-x64.sh {0}
        run: |
          cmake . -B out/secure-x64 -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON 
          cmake --build out/secure-x64 --parallel 4 --config Release
          ctest --test-dir out/secure-x64 --verbose --timeout 240 -C Release

      - name: Alpine arm32, Setup
        if: matrix.tests == 'alpine-arm32'
        uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
        with:
          arch: armv7  # or armhf for arm-v6 with hard float
          shell-name: alpine-arm32.sh
          packages: |
            build-base
            cmake

      - name: Alpine arm32, Debug
        if: matrix.tests == 'alpine-arm32'
        shell: alpine-arm32.sh {0}
        env:
          MI_TEST_LIGHT: 1
        run: |
          uname -m
          cmake . -B out/debug-arm32 -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG=FULL 
          cmake --build out/debug-arm32 --parallel 4 --config Debug
          ctest --test-dir out/debug-arm32 --verbose --timeout 240 -C Debug

      - name: Alpine arm32, Release
        if: matrix.tests == 'alpine-arm32'
        shell: alpine-arm32.sh {0}
        run: |
          cmake . -B out/release-arm32 -DCMAKE_BUILD_TYPE=Release  -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON
          cmake --build out/release-arm32 --parallel 4 --config Release
          ctest --test-dir out/release-arm32 --verbose --timeout 240 -C Release

      - name: Alpine arm32, Asm
        if: matrix.tests == 'alpine-arm32'
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: alpine-arm32-c-asm
          path: out/release-arm32/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Alpine arm32, Secure
        if: matrix.tests == 'alpine-arm32'
        shell: alpine-arm32.sh {0}
        run: |
          cmake . -B out/secure-arm32 -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON 
          cmake --build out/secure-arm32 --parallel 4 --config Release
          ctest --test-dir out/secure-arm32 --verbose --timeout 240 -C Release

      # - name: Android, Setup
      #   if: matrix.tests == 'android-x64'
      #   uses: android-actions/setup-android@v4
      #   #id: setup-ndk
      #   # with:
      #     # ndk-version: r27d
      #     # link-to-sdk: true
      #     # local-cache: true

      # - name: Android, Debug Build
      #   if: matrix.tests == 'android-x64'
      #   # env:
      #   #  ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
      #   run: |
      #     env
      #     cmake . -G Ninja -B out/android-x64 -DCMAKE_BUILD_TYPE=Debug \
      #       -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
      #       -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=android-27
      #     cmake --build out/android-x64 --parallel 4 --config Debug

      # - name: Android, Debug Run
      #   if: matrix.tests == 'android-x64'
      #   uses: reactivecircus/android-emulator-runner@v2
      #   with:
      #     api-level: 27
      #     target: default
      #     arch: x86_64
      #     script: |
      #       adb push out/android-x64/mimalloc-test-api /data/local/tmp/
      #       adb shell "/data/local/tmp/mimalloc-test-api"