|
| 1 | +name: Sanitizers (Disabled) |
| 2 | + |
| 3 | +# Workflow is disabled - only manual trigger available |
| 4 | +# To re-enable, uncomment the push and pull_request triggers below |
| 5 | +on: |
| 6 | + workflow_dispatch: # Manual trigger only |
| 7 | + # push: |
| 8 | + # branches: [ main, develop ] |
| 9 | + # pull_request: |
| 10 | + # branches: [ main, develop ] |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + # Detect which files have changed to skip unnecessary jobs |
| 18 | + changes: |
| 19 | + name: Detect Changes |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + pull-requests: read |
| 23 | + outputs: |
| 24 | + src: ${{ steps.filter.outputs.src }} |
| 25 | + tests: ${{ steps.filter.outputs.tests }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - uses: dorny/paths-filter@v3 |
| 29 | + id: filter |
| 30 | + with: |
| 31 | + filters: | |
| 32 | + src: |
| 33 | + - 'src/**' |
| 34 | + - 'CMakeLists.txt' |
| 35 | + - 'third_party/**' |
| 36 | + tests: |
| 37 | + - 'tests/**' |
| 38 | +
|
| 39 | + # AddressSanitizer - Detects memory errors (use-after-free, buffer overflows, etc.) |
| 40 | + asan: |
| 41 | + name: AddressSanitizer |
| 42 | + needs: changes |
| 43 | + if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' |
| 44 | + runs-on: ubuntu-latest |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout code |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Cache CMake dependencies |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: build/_deps |
| 54 | + key: ${{ runner.os }}-cmake-deps-asan-${{ hashFiles('CMakeLists.txt', 'third_party/**') }} |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.os }}-cmake-deps- |
| 57 | +
|
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + sudo apt-get update |
| 61 | + sudo apt-get install -y \ |
| 62 | + cmake \ |
| 63 | + build-essential \ |
| 64 | + libmysqlclient-dev \ |
| 65 | + libicu-dev \ |
| 66 | + libreadline-dev \ |
| 67 | + pkg-config |
| 68 | +
|
| 69 | + - name: Configure CMake with ASAN |
| 70 | + run: | |
| 71 | + mkdir -p build |
| 72 | + cd build |
| 73 | + cmake -DCMAKE_BUILD_TYPE=Debug \ |
| 74 | + -DBUILD_TESTS=ON \ |
| 75 | + -DENABLE_ASAN=ON \ |
| 76 | + -DUSE_ICU=ON \ |
| 77 | + -DUSE_MYSQL=ON \ |
| 78 | + .. |
| 79 | +
|
| 80 | + - name: Build |
| 81 | + run: | |
| 82 | + cd build |
| 83 | + make -j$(nproc) |
| 84 | +
|
| 85 | + - name: Run tests with ASAN |
| 86 | + run: | |
| 87 | + cd build |
| 88 | + # Set ASAN options for better error reporting |
| 89 | + export ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:detect_stack_use_after_return=1 |
| 90 | + ctest --output-on-failure --parallel $(nproc) |
| 91 | +
|
| 92 | + - name: Upload build artifacts on failure |
| 93 | + if: failure() |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: asan-build-logs |
| 97 | + path: | |
| 98 | + build/CMakeFiles/*.log |
| 99 | + build/Testing/Temporary/ |
| 100 | +
|
| 101 | + # ThreadSanitizer - Detects data races and thread safety issues |
| 102 | + tsan: |
| 103 | + name: ThreadSanitizer |
| 104 | + needs: changes |
| 105 | + if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' |
| 106 | + runs-on: ubuntu-latest |
| 107 | + |
| 108 | + steps: |
| 109 | + - name: Checkout code |
| 110 | + uses: actions/checkout@v4 |
| 111 | + |
| 112 | + - name: Cache CMake dependencies |
| 113 | + uses: actions/cache@v4 |
| 114 | + with: |
| 115 | + path: build/_deps |
| 116 | + key: ${{ runner.os }}-cmake-deps-tsan-${{ hashFiles('CMakeLists.txt', 'third_party/**') }} |
| 117 | + restore-keys: | |
| 118 | + ${{ runner.os }}-cmake-deps- |
| 119 | +
|
| 120 | + - name: Install dependencies |
| 121 | + run: | |
| 122 | + sudo apt-get update |
| 123 | + sudo apt-get install -y \ |
| 124 | + cmake \ |
| 125 | + build-essential \ |
| 126 | + libmysqlclient-dev \ |
| 127 | + libicu-dev \ |
| 128 | + libreadline-dev \ |
| 129 | + pkg-config |
| 130 | +
|
| 131 | + - name: Configure CMake with TSAN |
| 132 | + run: | |
| 133 | + mkdir -p build |
| 134 | + cd build |
| 135 | + cmake -DCMAKE_BUILD_TYPE=Debug \ |
| 136 | + -DBUILD_TESTS=ON \ |
| 137 | + -DENABLE_TSAN=ON \ |
| 138 | + -DUSE_ICU=ON \ |
| 139 | + -DUSE_MYSQL=ON \ |
| 140 | + .. |
| 141 | +
|
| 142 | + - name: Build |
| 143 | + run: | |
| 144 | + cd build |
| 145 | + make -j$(nproc) |
| 146 | +
|
| 147 | + - name: Run tests with TSAN |
| 148 | + run: | |
| 149 | + cd build |
| 150 | + # Set TSAN options for better error reporting |
| 151 | + export TSAN_OPTIONS=second_deadlock_stack=1:halt_on_error=0 |
| 152 | + ctest --output-on-failure --parallel $(nproc) |
| 153 | +
|
| 154 | + - name: Upload build artifacts on failure |
| 155 | + if: failure() |
| 156 | + uses: actions/upload-artifact@v4 |
| 157 | + with: |
| 158 | + name: tsan-build-logs |
| 159 | + path: | |
| 160 | + build/CMakeFiles/*.log |
| 161 | + build/Testing/Temporary/ |
0 commit comments