|
| 1 | +# Check code with compilers' sanitizers |
| 2 | +name: Sanitizers |
| 3 | + |
| 4 | +on: workflow_call |
| 5 | + |
| 6 | +env: |
| 7 | + BUILD_DIR : "${{github.workspace}}/build/" |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + icx-build: |
| 14 | + # TODO: we could merge ICX build with gcc/clang (using our dockers) Issue: #259 |
| 15 | + name: Intel C++ Compiler on Ubuntu |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + compiler: [{c: icx, cxx: icpx}] |
| 19 | + # TSAN is mutually exclusive with other sanitizers |
| 20 | + sanitizers: [{asan: ON, ubsan: ON, tsan: OFF}, {asan: OFF, ubsan: OFF, tsan: ON}] |
| 21 | + runs-on: ubuntu-22.04 |
| 22 | + container: |
| 23 | + image: intel/oneapi:latest |
| 24 | + volumes: |
| 25 | + - ${{github.workspace}}:${{github.workspace}} |
| 26 | + options: "--privileged" |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 31 | + |
| 32 | + - name: Install apt packages |
| 33 | + run: | |
| 34 | + apt-get update |
| 35 | + apt-get install -y cmake libnuma-dev libjemalloc-dev libtbb-dev libhwloc-dev |
| 36 | +
|
| 37 | + - name: Configure build |
| 38 | + run: > |
| 39 | + cmake |
| 40 | + -B ${{env.BUILD_DIR}} |
| 41 | + -DCMAKE_BUILD_TYPE=Debug |
| 42 | + -DUMF_BUILD_SHARED_LIBRARY=OFF |
| 43 | + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} |
| 44 | + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} |
| 45 | + -DUMF_BUILD_OS_MEMORY_PROVIDER=ON |
| 46 | + -DUMF_ENABLE_POOL_TRACKING=ON |
| 47 | + -DUMF_FORMAT_CODE_STYLE=OFF |
| 48 | + -DUMF_DEVELOPER_MODE=ON |
| 49 | + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON |
| 50 | + -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON |
| 51 | + -DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON |
| 52 | + -DUSE_ASAN=${{matrix.sanitizers.asan}} |
| 53 | + -DUSE_UBSAN=${{matrix.sanitizers.ubsan}} |
| 54 | + -DUSE_TSAN=${{matrix.sanitizers.tsan}} |
| 55 | + -DUMF_BUILD_EXAMPLES=ON |
| 56 | +
|
| 57 | + - name: Build UMF |
| 58 | + run: cmake --build ${{env.BUILD_DIR}} -j $(nproc) |
| 59 | + |
| 60 | + - name: Run tests |
| 61 | + working-directory: ${{env.BUILD_DIR}} |
| 62 | + run: ctest --output-on-failure |
| 63 | + |
| 64 | + ubuntu-build: |
| 65 | + name: gcc and clang on Ubuntu |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}] |
| 69 | + # TSAN is mutually exclusive with other sanitizers |
| 70 | + sanitizers: [{asan: ON, ubsan: ON, tsan: OFF}, {asan: OFF, ubsan: OFF, tsan: ON}] |
| 71 | + runs-on: ubuntu-22.04 |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 76 | + |
| 77 | + - name: Install apt packages |
| 78 | + run: | |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install -y clang cmake libhwloc-dev libnuma-dev libjemalloc-dev libtbb-dev |
| 81 | +
|
| 82 | + - name: Configure build |
| 83 | + run: > |
| 84 | + cmake |
| 85 | + -B ${{env.BUILD_DIR}} |
| 86 | + -DCMAKE_BUILD_TYPE=Debug |
| 87 | + -DUMF_BUILD_SHARED_LIBRARY=OFF |
| 88 | + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} |
| 89 | + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} |
| 90 | + -DUMF_BUILD_OS_MEMORY_PROVIDER=ON |
| 91 | + -DUMF_ENABLE_POOL_TRACKING=ON |
| 92 | + -DUMF_FORMAT_CODE_STYLE=OFF |
| 93 | + -DUMF_DEVELOPER_MODE=ON |
| 94 | + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON |
| 95 | + -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON |
| 96 | + -DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON |
| 97 | + -DUSE_ASAN=${{matrix.sanitizers.asan}} |
| 98 | + -DUSE_UBSAN=${{matrix.sanitizers.ubsan}} |
| 99 | + -DUSE_TSAN=${{matrix.sanitizers.tsan}} |
| 100 | + -DUMF_BUILD_EXAMPLES=ON |
| 101 | +
|
| 102 | + - name: Build UMF |
| 103 | + run: cmake --build ${{env.BUILD_DIR}} -j $(nproc) |
| 104 | + |
| 105 | + - name: Run tests |
| 106 | + working-directory: ${{env.BUILD_DIR}} |
| 107 | + run: ctest --output-on-failure |
| 108 | + |
| 109 | + windows-build: |
| 110 | + name: cl and clang-cl on Windows |
| 111 | + strategy: |
| 112 | + matrix: |
| 113 | + compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}] |
| 114 | + # Only ASAN is supported |
| 115 | + sanitizers: [{asan: ON}] |
| 116 | + runs-on: windows-2022 |
| 117 | + |
| 118 | + steps: |
| 119 | + - name: Checkout |
| 120 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 121 | + |
| 122 | + # Use '14.38.33130' MSVC toolset when compiling UMF with ASan. |
| 123 | + # Running binaries compiled with older toolsets results in a |
| 124 | + # 'STATUS_DLL_INIT_FAILED' error despite being linked with ASan from |
| 125 | + # the same toolset as the compiler being used. |
| 126 | + # https://github.com/actions/runner-images/issues/8891 |
| 127 | + - name: Setup MSVC dev command prompt |
| 128 | + if: matrix.sanitizers.asan == 'ON' |
| 129 | + uses: TheMrMilchmann/setup-msvc-dev@48edcef51a12c80d7e62ace57aae1417795e511c # v3.0.0 |
| 130 | + with: |
| 131 | + arch: x64 |
| 132 | + toolset: 14.38.33130 |
| 133 | + |
| 134 | + - name: Configure build |
| 135 | + run: > |
| 136 | + cmake |
| 137 | + -B ${{env.BUILD_DIR}} |
| 138 | + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} |
| 139 | + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} |
| 140 | + -DUMF_BUILD_SHARED_LIBRARY=OFF |
| 141 | + -DUMF_ENABLE_POOL_TRACKING=OFF |
| 142 | + -DUMF_FORMAT_CODE_STYLE=OFF |
| 143 | + -DUMF_DEVELOPER_MODE=ON |
| 144 | + -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON |
| 145 | + -DUSE_ASAN=${{matrix.sanitizers.asan}} |
| 146 | + -DUMF_BUILD_OS_MEMORY_PROVIDER=ON |
| 147 | + -DUMF_BUILD_EXAMPLES=ON |
| 148 | +
|
| 149 | + - name: Build UMF |
| 150 | + run: cmake --build ${{env.BUILD_DIR}} --config Debug -j $Env:NUMBER_OF_PROCESSORS |
| 151 | + |
| 152 | + - name: Run tests |
| 153 | + working-directory: ${{env.BUILD_DIR}} |
| 154 | + run: ctest -C Debug --output-on-failure |
0 commit comments