Skip to content

perf(elreal,ci): cut sanitizer/Debug CI time ~20x (depth, -O1, ctest -j) #1081

perf(elreal,ci): cut sanitizer/Debug CI time ~20x (depth, -O1, ctest -j)

perf(elreal,ci): cut sanitizer/Debug CI time ~20x (depth, -O1, ctest -j) #1081

Workflow file for this run

name: Sanitizers
on:
schedule:
- cron: '0 6 * * 0' # Weekly on Sunday at 6 AM UTC
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened, ready_for_review ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'docs-site/**'
- '.github/FUNDING.yml'
- 'CITATION.cff'
- 'LICENSE'
- '.clang-format'
- '.clang-tidy'
- '.gitignore'
workflow_dispatch: # Manual trigger
permissions:
contents: read
env:
# Force Node.js 24 for all JavaScript actions (eliminates Node.js 20 deprecation warnings)
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
sanitizers:
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.draft == false
name: "${{ matrix.sanitizer }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- sanitizer: ASan
cmake_flags: -DUNIVERSAL_ENABLE_ASAN=ON
env_vars: ASAN_OPTIONS=detect_leaks=0:halt_on_error=1
- sanitizer: UBSan
cmake_flags: -DUNIVERSAL_ENABLE_UBSAN=ON
env_vars: UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Clang
run: |
sudo apt-get update
sudo apt-get install -y clang
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DUNIVERSAL_BUILD_CI=ON \
${{ matrix.cmake_flags }}
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
- name: Test
working-directory: ${{github.workspace}}/build
env:
ASAN_OPTIONS: ${{ matrix.sanitizer == 'ASan' && 'detect_leaks=0:halt_on_error=1' || '' }}
UBSAN_OPTIONS: ${{ matrix.sanitizer == 'UBSan' && 'print_stacktrace=1:halt_on_error=1' || '' }}
# -j 2 matches the 2-vCPU ubuntu-latest runner; safe under ASan's ~2-3x
# shadow-memory multiplier in 7 GB. --timeout caps any hung instrumented
# test at 180s instead of CTest's 1500s default.
run: ctest -j 2 --timeout 180 --output-on-failure
- name: Rerun failed tests
if: failure()
working-directory: ${{github.workspace}}/build
env:
ASAN_OPTIONS: ${{ matrix.sanitizer == 'ASan' && 'detect_leaks=0:halt_on_error=1' || '' }}
UBSAN_OPTIONS: ${{ matrix.sanitizer == 'UBSan' && 'print_stacktrace=1:halt_on_error=1' || '' }}
run: ctest -j 2 --timeout 180 --rerun-failed --output-on-failure
- name: Upload test logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: test-logs-${{ matrix.sanitizer }}
path: |
${{github.workspace}}/build/Testing
${{github.workspace}}/build/CMakeCache.txt
${{github.workspace}}/build/CMakeFiles/CMakeOutput.log
${{github.workspace}}/build/CMakeFiles/CMakeError.log