|
| 1 | +# SPDX-FileCopyrightText: 2006-2024, Knut Reinert & Freie Universität Berlin |
| 2 | +# SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik |
| 3 | +# SPDX-License-Identifier: CC0-1.0 |
| 4 | + |
| 5 | +name: Sanitizer |
| 6 | + |
| 7 | +on: |
| 8 | + schedule: |
| 9 | + - cron: "0 6 * * SAT" |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: sanitizer-actions |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +env: |
| 17 | + SEQAN3_NO_VERSION_CHECK: 1 |
| 18 | + TZ: Europe/Berlin |
| 19 | + TSAN_OPTIONS: ignore_noninstrumented_modules=1 |
| 20 | + UBSAN_OPTIONS: print_stacktrace=1 |
| 21 | + |
| 22 | +defaults: |
| 23 | + run: |
| 24 | + shell: bash -Eeuxo pipefail {0} |
| 25 | + |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.os }} |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' |
| 31 | + env: |
| 32 | + ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=${{ contains(matrix.os, 'macos') && '0' || '1' }} |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + name: [ASan, TSan, UBSan] |
| 37 | + os: [ubuntu-latest, macos-14] |
| 38 | + build_type: [Release, RelWithDebInfo, Debug] |
| 39 | + exclude: |
| 40 | + # macOS llvm packages do not contain libarcher, which is required for TSan to handle OpenMP. |
| 41 | + # TSan runs on ubuntu with clang. Packages there contain libarcher. |
| 42 | + - name: "TSan" |
| 43 | + os: macos-14 |
| 44 | + |
| 45 | + include: |
| 46 | + - os: macos-14 |
| 47 | + compiler: clang-19 |
| 48 | + - os: ubuntu-latest |
| 49 | + compiler: gcc-14 |
| 50 | + image: ghcr.io/seqan/gcc-14 |
| 51 | + |
| 52 | + - name: "TSan" |
| 53 | + os: ubuntu-latest |
| 54 | + compiler: clang-19 |
| 55 | + image: ghcr.io/seqan/clang-19 |
| 56 | + cxx_flags: "-fsanitize=thread" |
| 57 | + ctest_excludes: "-E async_input_buffer_snippet" |
| 58 | + |
| 59 | + - name: "ASan" |
| 60 | + os: ubuntu-latest |
| 61 | + cxx_flags: "-fsanitize=address -Wno-maybe-uninitialized" |
| 62 | + - name: "ASan" |
| 63 | + os: macos-14 |
| 64 | + cxx_flags: "-fsanitize=address" |
| 65 | + |
| 66 | + - name: "UBSan" |
| 67 | + os: ubuntu-latest |
| 68 | + cxx_flags: "-fsanitize=undefined,float-divide-by-zero -Wno-maybe-uninitialized -Wno-stringop-overflow" |
| 69 | + - name: "UBSan" |
| 70 | + os: macos-14 |
| 71 | + cxx_flags: "-fsanitize=undefined,float-divide-by-zero,local-bounds,nullability" |
| 72 | + ctest_excludes: "-E tmp_directory_snippet_cmp_output" |
| 73 | + |
| 74 | + container: |
| 75 | + # If an image is defined for a matrix entry, use it. |
| 76 | + # Otherwise, use the "empty"/'' image which means do not use a container at all. |
| 77 | + image: ${{ matrix.image || '' }} |
| 78 | + volumes: |
| 79 | + - /home/runner:/home/runner |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - name: Setup compiler |
| 85 | + if: contains(matrix.os, 'macos') |
| 86 | + uses: seqan/actions/setup-compiler@main |
| 87 | + with: |
| 88 | + compiler: ${{ matrix.compiler }} |
| 89 | + |
| 90 | + - name: Configure tests |
| 91 | + run: | |
| 92 | + mkdir build && cd build |
| 93 | + cmake ../test/analyse -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 94 | + -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer ${{ matrix.cxx_flags }} -fno-sanitize-recover=all" \ |
| 95 | + -DSEQAN3_BENCHMARK_MIN_TIME=0.01s \ |
| 96 | + -DSEQAN3_WITH_SEQAN2_CI=OFF |
| 97 | + make gtest_main benchmark_main |
| 98 | +
|
| 99 | + - name: Build tests |
| 100 | + working-directory: build |
| 101 | + run: make -k |
| 102 | + |
| 103 | + - name: Run tests |
| 104 | + working-directory: build |
| 105 | + continue-on-error: true |
| 106 | + id: test |
| 107 | + run: ctest . -j --output-on-failure --no-tests=error ${{ matrix.ctest_excludes }} |
| 108 | + |
| 109 | + # Rerun failed tests with **one** thread. Some snippets touch the same file and fail in parallel. |
| 110 | + - name: Rerun failed tests |
| 111 | + if: steps.test.outcome == 'failure' |
| 112 | + working-directory: build |
| 113 | + run: ctest . -j1 --output-on-failure --no-tests=error --rerun-failed |
0 commit comments