diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 60f69e7..2015dfd 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -11,6 +11,11 @@ jobs: strategy: matrix: buildtype: [debug, release] + sanitizer: [none, address, leak, undefined, thread] + exclude: + # False positive warnings in release builds: https://godbolt.org/z/vT3nqGxzW + - buildtype: release + sanitizer: address runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -21,13 +26,14 @@ jobs: - name: Set up ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: ccache-linux-${{ matrix.buildtype }} + key: ccache-linux-${{ matrix.buildtype }}-${{ matrix.sanitizer }} - name: Setup compiler and build tools run: sudo apt install --no-install-recommends --yes g++-12 meson ninja-build - name: Configure run: | CXX="ccache g++-12" meson setup \ --buildtype ${{ matrix.buildtype }} \ + -Db_sanitize=${{ matrix.sanitizer }} \ --warnlevel 3 \ --werror \ build . @@ -36,4 +42,7 @@ jobs: - name: Setup Test run: cd test/setup && ./setup - name: Test - run: cd build && ./unit + run: | + export ASAN_OPTIONS=fast_unwind_on_malloc=0:strict_string_checks=1:detect_leaks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 + export UBSAN_OPTIONS=print_stacktrace=1 + cd build && ./unit