on:
workflow_dispatch: push:
branches:
- 'dev*'
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
name: Test
permissions:
contents: read
env:
MIMALLOC_SHOW_ERRORS: 1
defaults:
run:
shell: bash
jobs:
basic:
name: basic, ${{ matrix.os }}, ${{ matrix.lang }}
runs-on: ${{ matrix.os }}
env:
CI_CMAKE_ARGS: ${{ matrix.lang_args }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest, macos-15, macos-15-intel, ubuntu-22.04-arm, windows-11-arm]
lang: [c, cxx]
include:
- lang: c
lang_args: -DMI_USE_CXX=OFF
- lang: cxx
lang_args: -DMI_USE_CXX=ON
- os: windows-latest lang: cxx
lang_args: -DMI_USE_CXX=ON -DCMAKE_CXX_STANDARD=20
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Release
run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON
- name: Release, Asm
if: runner.os == 'Linux' && matrix.lang == 'c'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with:
name: ${{ matrix.os }}-${{ matrix.lang }}-asm
path: out/release/CMakeFiles/mimalloc-static.dir/src/*.s
- name: Debug
run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL
- name: Secure
run: sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON
- name: Release, PAC weak
if: runner.os == 'Linux' && runner.arch == 'X64' && matrix.lang == 'c'
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-pac-weak Release -DMI_PAC=WEAK
- name: Debug, Win32
if: runner.os == 'Windows'
run: sh .github/ci/cmake-test.sh debug-x86 Debug -A Win32
- name: Release, Win32
if: runner.os == 'Windows'
run: sh .github/ci/cmake-test.sh release-x86 Release -A Win32
- name: Release, MTE prefer, PAC
if: matrix.os == 'ubuntu-22.04-arm' && matrix.lang == 'c'
run: |
if grep -qw mte /proc/cpuinfo; then echo "::notice::native MTE is available"; else echo "::notice::native MTE is not available"; fi
if grep -qw pacg /proc/cpuinfo; then echo "::notice::native PAC is available"; else echo "::notice::native PAC is not available"; fi
sh .github/ci/cmake-test.sh release-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=PREFER -DMI_PAC=ON
extra-linux:
name: extra, ${{ matrix.os }}, c
runs-on: ${{ matrix.os }}
env:
CI_PARALLEL: 8
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-22.04-arm]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Release, SIMD
run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON
- name: Debug, TLS pthreads
run: sh .github/ci/cmake-test.sh debug-tls-pthreads Debug -DMI_TLS_MODEL_PTHREADS=ON
- name: Release, TLS pthreads
run: sh .github/ci/cmake-test.sh release-tls-pthreads Release -DMI_TLS_MODEL_PTHREADS=ON -DMI_SEE_ASM=ON
- name: Debug, C++, clang++
run: CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-clang-cxx Debug -DMI_DEBUG=FULL -DMI_USE_CXX=ON
- name: Release, C++, clang++
run: CC=clang CXX=clang++ sh .github/ci/cmake-test.sh release-clang-cxx Release -DMI_OPT_ARCH=ON -DMI_USE_CXX=ON -DMI_SEE_ASM=ON
- name: Release, C++, clang++, Asm
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with:
name: ${{ matrix.os }}-clang-cxx-asm
path: out/release-clang-cxx/CMakeFiles/mimalloc-static.dir/src/*.s
- name: Debug, ASAN
run: MI_TEST_LIGHT=1 CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-asan Debug -DMI_DEBUG=FULL -DMI_TRACK=ASAN
- name: Debug, UBSAN
run: MI_TEST_LIGHT=1 CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-ubsan-cxx Debug -DMI_DEBUG=FULL -DMI_DEBUG_UBSAN=ON
- name: Debug, Guarded
run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=1024 sh .github/ci/cmake-test.sh debug-guarded Debug -DMI_DEBUG=FULL -DMI_GUARDED=FULL
- name: Debug, Secure Full
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-full Debug -DMI_DEBUG=FULL -DMI_SECURE=FULL
- name: Release, Secure Full
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-full Release -DMI_OPT_ARCH=ON -DMI_SECURE=FULL
- name: Release, Secure, PAC weak
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-pac-weak Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON -DMI_PAC=WEAK
- name: Debug, Secure, PAC weak
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-pac-weak Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_PAC=WEAK
- name: Release, Guarded
if: startsWith(github.ref_name,'dev3')
run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=128 sh .github/ci/cmake-test.sh release-guarded Release -DMI_OPT_ARCH=ON -DMI_GUARDED=FULL
- name: Debug, Use pagemap
if: startsWith(github.ref_name,'dev3')
run: sh .github/ci/cmake-test.sh debug-pagemap Debug -DMI_DEBUG=FULL -DMI_FREE_USE_PAGEMAP=ON
- name: Release, Use pagemap
if: startsWith(github.ref_name,'dev3')
run: sh .github/ci/cmake-test.sh release-pagemap Release -DMI_OPT_ARCH=ON -DMI_FREE_USE_PAGEMAP=ON
extra-windows:
name: extra, ${{ matrix.os }}, c
runs-on: ${{ matrix.os }}
env:
CI_PARALLEL: 8
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-11-arm]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Release, SIMD
run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON
- name: Debug, Guarded
run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=1024 sh .github/ci/cmake-test.sh debug-guarded Debug -DMI_DEBUG=FULL -DMI_GUARDED=FULL
- name: Debug, Secure Full
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-full Debug -DMI_DEBUG=FULL -DMI_SECURE=FULL
- name: Release, Secure Full
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-full Release -DMI_OPT_ARCH=ON -DMI_SECURE=FULL
- name: Release, Secure, PAC weak
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-pac-weak Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON -DMI_PAC=WEAK
- name: Debug, Secure, PAC weak
run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-pac-weak Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_PAC=WEAK
extra-macos:
name: extra, ${{ matrix.os }}, c
runs-on: ${{ matrix.os }}
env:
CI_PARALLEL: 8
strategy:
fail-fast: false
matrix:
os: [macos-latest, macos-15-intel]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Release, SIMD
run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON
- name: Debug, TLS fixed
run: sh .github/ci/cmake-test.sh debug-tls-fixed Debug -DMI_TLS_MODEL_FIXED=ON
- name: Release, TLS fixed
run: sh .github/ci/cmake-test.sh release-tls-fixed Release -DMI_TLS_MODEL_FIXED=ON
- name: Debug, MTE prefer
if: runner.arch == 'ARM64'
run: sh .github/ci/cmake-test.sh debug-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER
- name: Release, MTE prefer, PAC
if: runner.arch == 'ARM64'
run: sh .github/ci/cmake-test.sh release-mte Release -DMI_MTE=PREFER -DMI_PAC=ON
- name: Debug, Secure, MTE prefer
if: runner.arch == 'ARM64'
run: sh .github/ci/cmake-test.sh debug-secure-mte Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_MTE=PREFER
- name: Release, Secure, MTE prefer, PAC
if: runner.arch == 'ARM64'
run: sh .github/ci/cmake-test.sh release-secure-mte Release -DMI_SECURE=ON -DMI_MTE=PREFER -DMI_PAC=ON
windows-clang:
name: clang, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-11-arm]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Debug, Win32, clang-cl
run: sh .github/ci/cmake-test.sh debug-x86-clang-cl Debug -A Win32 -T ClangCl
- name: Release, Win32, clang-cl
run: sh .github/ci/cmake-test.sh release-x86-clang-cl Release -A Win32 -T ClangCl
- name: Debug, clang-cl
run: sh .github/ci/cmake-test.sh debug-clang-cl Debug -T ClangCl
- name: Release, clang-cl
run: sh .github/ci/cmake-test.sh release-clang-cl Release -T ClangCl
- name: Debug, clang
run: sh .github/ci/cmake-test.sh debug-clang Debug -DCMAKE_C_COMPILER=clang
- name: Release, clang
run: sh .github/ci/cmake-test.sh release-clang Release -DCMAKE_C_COMPILER=clang
freebsd:
name: qemu, freebsd-x64
runs-on: ubuntu-latest
defaults:
run:
shell: freebsd {0}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc with:
arch: x86_64
usesh: true
custom-shell-name: freebsd
cache-after-prepare: true
prepare: |
pkg install -y cmake
- name: Debug
run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL
- name: Release
run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON
- name: Secure
run: sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON
alpine:
name: qemu, alpine-${{ matrix.target }}
runs-on: ubuntu-24.04 continue-on-error: true
defaults:
run:
shell: alpine.sh {0}
env:
CI_CMAKE_ARGS: ${{ matrix.cmake_args }}
strategy:
fail-fast: false
matrix:
include:
- target: x64
arch: x86_64
- target: riscv64
arch: riscv64
packages: ninja clang
apk_tools_url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v3.0.7/x86_64/apk.static#!sha256!c07bf5356eacc9dd7a8c56bc537f46702f007170287403299d52a04264e74b3c
cmake_args: -G Ninja
test_env: MI_TEST_LIGHT=2
- target: arm32
arch: armv7 test_env: MI_TEST_LIGHT=2
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 with:
arch: ${{ matrix.arch }}
apk-tools-url: ${{ matrix.apk_tools_url || 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/x86_64/apk.static#!sha256!34bb1a96f0258982377a289392d4ea9f3f4b767a4bb5806b1b87179b79ad8a1c' }}
packages: build-base cmake ${{ matrix.packages }}
- name: Release, clang
if: matrix.target == 'riscv64'
run: ${{ matrix.test_env }} CC=clang CXX=clang++ sh .github/ci/cmake-test.sh release-clang Release -DMI_OPT_ARCH=rv64gcb_zacas_zalasr -DMI_SEE_ASM=ON
- name: Release, clang, Asm
if: matrix.target == 'riscv64'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with:
name: alpine-${{ matrix.target }}-clang-asm
path: out/release-clang/CMakeFiles/mimalloc-static.dir/src/*.s
- name: Release
if: matrix.target != 'riscv64' && matrix.target != 'arm32' run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON
- name: Debug
run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL
- name: Secure
if: matrix.target != 'riscv64'
run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON
linux-arm64-mte:
name: qemu, linux-arm64-mte
runs-on: ubuntu-latest
env:
QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
QEMU_CPU: max
MI_TEST_LIGHT: 1
MI_TEST_REQUIRE_MTE: 1
CI_CMAKE_ARGS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64
CI_CTEST_ARGS: -E test-fork
CI_CTEST_TIMEOUT: 600
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
run: |
sudo apt-get update -q
sudo apt-get install -y -q gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
qemu-aarch64 --version
ls /proc/sys/fs/binfmt_misc/ | grep aarch64 || echo "no binfmt registration for aarch64"
- name: Release, MTE, PAC
run: sh .github/ci/cmake-test.sh release-arm64-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON
- name: Release, MTE, PAC, verbose test-mte
run: MIMALLOC_VERBOSE=1 qemu-aarch64 out/release-arm64-mte/mimalloc-test-mte
- name: Release, Async, MTE, PAC
run: MIMALLOC_MTE=async sh .github/ci/cmake-test.sh release-arm64-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON
- name: Debug, MTE
run: sh .github/ci/cmake-test.sh debug-arm64-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER
android-arm64:
name: qemu, android-arm64
runs-on: ubuntu-latest
env:
QEMU_CPU: max
MI_TEST_LIGHT: 1
CI_CTEST_ARGS: -E test-fork
CI_CTEST_TIMEOUT: 600
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
run: |
sudo apt-get update -q
sudo apt-get install -y -q qemu-user
qemu-aarch64 --version
NDK="${ANDROID_NDK_LATEST_HOME:-$ANDROID_NDK_HOME}"
test -f "$NDK/build/cmake/android.toolchain.cmake" || { echo "::error::Android NDK not found"; exit 1; }
echo "NDK: $NDK"
echo "CI_CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-30 -DANDROID_STL=c++_static -DMI_BUILD_SHARED=OFF -DMI_OVERRIDE=OFF -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64" >> $GITHUB_ENV
- name: Debug
run: sh .github/ci/cmake-test.sh debug-android Debug -DMI_DEBUG=FULL
- name: Release
run: sh .github/ci/cmake-test.sh release-android Release -DMI_OPT_ARCH=ON
- name: Secure
run: sh .github/ci/cmake-test.sh secure-android Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON
- name: Debug, MTE prefer
run: MI_TEST_REQUIRE_MTE=1 sh .github/ci/cmake-test.sh debug-android-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER
- name: Release, MTE, PAC
run: MI_TEST_REQUIRE_MTE=1 sh .github/ci/cmake-test.sh release-android-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON
- name: Release, MTE, PAC, verbose test-mte
run: MIMALLOC_VERBOSE=1 qemu-aarch64 out/release-android-mte/mimalloc-test-mte
tsan:
name: tsan, ubuntu-latest
runs-on: ubuntu-latest
env:
CC: clang
CXX: clang++
CI_PARALLEL: 8
CI_CTEST_TIMEOUT: 360
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Debug, TSAN
run: sh .github/ci/cmake-test.sh debug-tsan Debug -DMI_DEBUG=FULL -DMI_DEBUG_TSAN=ON
cheri-sim:
name: cheri-sim, ubuntu-latest
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -include ${{ github.workspace }}/test/cheri-sim.h -Wno-builtin-macro-redefined -U__SIZEOF_POINTER__ -D__SIZEOF_POINTER__=16
CI_CMAKE_ARGS: -DMI_BUILD_SHARED=OFF
CI_CTEST_ARGS: -E ^test-rust$
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Release
run: sh .github/ci/cmake-test.sh release-cheri-sim Release
- name: Debug
run: sh .github/ci/cmake-test.sh debug-cheri-sim Debug -DMI_DEBUG=FULL
- name: Guarded
run: |
MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh guarded-cheri-sim Release -DMI_GUARDED=ON
MIMALLOC_GUARDED_SAMPLE_RATE=1 out/guarded-cheri-sim/mimalloc-test-api
emscripten:
name: emscripten
runs-on: ubuntu-latest
env:
CI_CMAKE: emcmake cmake
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
uses: mymindstorm/setup-emsdk@4528d102f7230f0e7b276855c01ea1159be0e984
- name: Release
run: sh .github/ci/cmake-test.sh release-wasm Release -DCMAKE_C_FLAGS=-pthread
- name: Debug
run: sh .github/ci/cmake-test.sh debug-wasm Debug -DMI_DEBUG=FULL -DCMAKE_C_FLAGS=-pthread
- name: Single threaded
run: sh .github/ci/cmake-test.sh single-wasm Release
mingw:
name: mingw-${{ matrix.target }}
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
include:
- target: ucrt64
msystem: UCRT64
cc: gcc
- target: mingw64
msystem: MINGW64 cc: gcc
- target: clang64
msystem: CLANG64 cc: clang
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Setup
uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e with:
msystem: ${{ matrix.msystem }}
suppress-deprecation-warnings: msystem-mingw64 pacboy: ${{ matrix.cc }}:p git:p make:p cmake:p
- name: Debug
run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL
- name: Release
if: matrix.target == 'ucrt64'
run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON