Skip to content

Fix sccache-action version #11

Fix sccache-action version

Fix sccache-action version #11

Workflow file for this run

name: Sanitizers
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
actions: write
env:
SCCACHE_GHA_ENABLED: "true"
jobs:
sanitize:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sanitizer: [asan, ubsan, tsan]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system tools
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends ninja-build clang
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Conan
run: pip install "conan>=2.0,<3"
- name: Detect Conan profile
run: conan profile detect --force
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Start sccache server
run: |
if ! sccache --start-server; then
echo "SCCACHE_DISABLED=true" >> "$GITHUB_ENV"
echo "::warning::sccache server failed to start (GHA cache unavailable), building without cache"
fi
- name: Cache Conan packages
uses: actions/cache@v4
with:
path: ~/.conan2/p
key: ${{ runner.os }}-clang-conan-${{ hashFiles('conanfile.txt') }}-relwithdebinfo
restore-keys: |
${{ runner.os }}-clang-conan-
- name: Conan install
run: |
mkdir -p build
cd build
conan install .. --build=missing -pr:b=default -s build_type=RelWithDebInfo
- name: List CMake presets (diagnostic)
run: cmake --list-presets || true
- name: Configure
run: |
SAN_FLAG=""
case "${{ matrix.sanitizer }}" in
asan) SAN_FLAG="-DPOLYCPP_ENABLE_ASAN=ON" ;;
ubsan) SAN_FLAG="-DPOLYCPP_ENABLE_UBSAN=ON" ;;
tsan) SAN_FLAG="-DPOLYCPP_ENABLE_TSAN=ON" ;;
*) echo "Unknown sanitizer" && exit 1 ;;
esac
cmake -S . -B build/RelWithDebInfo -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=build/RelWithDebInfo/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPOLYCPP_WARNINGS_AS_ERRORS=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
"$SAN_FLAG"
- name: Build
run: cmake --build build/RelWithDebInfo
- name: Test
run: |
case "${{ matrix.sanitizer }}" in
asan)
export ASAN_OPTIONS='abort_on_error=1:strict_string_checks=1:detect_leaks=1:halt_on_error=1'
;;
ubsan)
export UBSAN_OPTIONS='print_stacktrace=1:halt_on_error=1'
;;
tsan)
export TSAN_OPTIONS='halt_on_error=1:second_deadlock_stack=1'
;;
esac
ctest --test-dir build/RelWithDebInfo --output-on-failure
- name: sccache stats
if: always()
run: sccache --show-stats