diff --git a/.github/workflows/build-sanitizers.yml b/.github/workflows/build-sanitizers.yml new file mode 100644 index 0000000..92e080d --- /dev/null +++ b/.github/workflows/build-sanitizers.yml @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: 2026 Klarälvdalens Datakonsult AB, a KDAB Group company +# +# SPDX-License-Identifier: MIT + +name: CI (Sanitizers) + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: + - ubuntu-24.04 + preset: ['dev-asan'] + include: + - preset: dev-asan + qt-flavor: asan + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Sanitized Qt + uses: KDABLabs/sanitized-qt-action@v1 + with: + qt-tag: "v6.11.0-beta2" + qt-flavor: ${{ matrix.qt-flavor }} + + - name: Configure + run: cmake --preset=${{ matrix.preset }} + + - name: Build + run: cmake --build ./build-${{ matrix.preset }} + + - name: Run tests + run: | + ctest --test-dir ./build-${{ matrix.preset }} --output-on-failure --verbose + env: + LSAN_OPTIONS: "detect_leaks=0" diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..61453db --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,40 @@ +{ + "version": 5, + "configurePresets": [ + { + "name": "base", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "hidden": true, + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "warnings": { + "uninitialized": true + }, + "errors": { + "dev": true + } + }, + { + "name": "dev", + "inherits": ["base"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "KDSingleApplication_DOCS": "OFF", + "KDSingleApplication_EXAMPLES": "ON", + "KDSingleApplication_TESTS": "ON", + "KDSingleApplication_QT6": "ON" + } + }, + { + "name": "dev-asan", + "inherits": ["dev"], + "cacheVariables": { + "CMAKE_CXX_FLAGS": "-DQT_FORCE_ASSERTS -fsanitize=address -fsanitize=undefined -fno-optimize-sibling-calls", + "CMAKE_SHARED_LINKER_FLAGS": "-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer", + "CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" + } + } + ] +}