From 6fa7747b4c37afc5ec49ef9330b30346a14b886c Mon Sep 17 00:00:00 2001 From: Haithem Ben Ghorbal Date: Tue, 6 Oct 2026 13:56:54 +0200 Subject: [PATCH] Updated CI: actions/checkout v4, added sanitizer jobs actions/checkout@v2 is deprecated. Added a Debug job on Ubuntu with AddressSanitizer and UndefinedBehaviorSanitizer which must pass, and a ThreadSanitizer job which is informative only (continue-on-error), because CallbackList::empty() and hasAnyListener() read shared data without locking on purpose and ThreadSanitizer reports that as data races. --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8b0910..b65d4e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest] build-type: [Release] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Configure run: | @@ -21,4 +21,43 @@ jobs: run: cmake --build build --config "${{ matrix.build-type }}" -j - name: Run unit tests - run: cd build && ctest --build-config "${{ matrix.build-type }}" --progress --verbose \ No newline at end of file + run: cd build && ctest --build-config "${{ matrix.build-type }}" --progress --verbose + + # Debug build with sanitizers. AddressSanitizer and UndefinedBehaviorSanitizer must pass. + Sanitizers: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Configure + run: | + mkdir -p build + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" -B build -S tests + + - name: Build Tests + run: cmake --build build -j + + - name: Run unit tests + run: cd build && ctest --progress --verbose + env: + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 + ASAN_OPTIONS: detect_leaks=1 + + # ThreadSanitizer is informative only. CallbackList::empty() and hasAnyListener() read shared data + # without locking on purpose (see the comments in the code), which ThreadSanitizer reports as data races. + ThreadSanitizer: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@v4 + + - name: Configure + run: | + mkdir -p build + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" -B build -S tests + + - name: Build Tests + run: cmake --build build -j + + - name: Run unit tests + run: cd build && ctest --progress --verbose