doc: examples use declarative configuration 6/N (#380) #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: sanitize | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
env: | |
vcpkg_SHA: "dfcd4e4b30799c4ce02fe3939b62576fec444224" | |
jobs: | |
sanitized-build: | |
# Using a blank name produces better output on | |
# the web UI (e.g. "sanitize / (address)") than | |
# any other alternative we tried. | |
name: " " | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
sanitizer: ["address", "undefined", "thread"] | |
steps: | |
- name: install ninja | |
run: sudo apt install ninja-build | |
- uses: actions/checkout@v2 | |
- name: clone-vcpkg | |
working-directory: "${{runner.temp}}" | |
run: > | |
mkdir -p vcpkg && | |
curl -sSL "https://github.com/microsoft/vcpkg/archive/${{env.vcpkg_SHA}}.tar.gz" | | |
tar -C vcpkg --strip-components=1 -zxf - | |
- name: cache-vcpkg | |
id: cache-vcpkg | |
uses: actions/cache@v2 | |
with: | |
# Preserve the vcpkg binary *and* the vcpkg binary cache in the build cache | |
path: | | |
~/.cache/vcpkg | |
~/.cache/bin | |
key: | | |
vcpkg-${{ env.vcpkg_SHA }}-sanitize-${{ matrix.sanitizer }}-${{ hashFiles('vcpkg.json') }} | |
restore-keys: | | |
vcpkg-${{ env.vcpkg_SHA }}-sanitize-${{ matrix.sanitizer }}- | |
- name: boostrap-vcpkg | |
run: ci/restore-vcpkg-from-cache.sh "${{runner.temp}}/vcpkg" | |
- name: -fsanitize=${{matrix.sanitizer}} / configure | |
# See https://github.com/grpc/grpc/pull/22325 for an explanation around the | |
# -DGRPC_* flags. | |
run: > | |
cmake -S . -B "${{runner.temp}}/build" -GNinja | |
-DCMAKE_CXX_COMPILER=clang++-14 | |
-DCMAKE_C_COMPILER=clang-14 | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}} -DGRPC_TSAN_SUPPRESSED -DGRPC_ASAN_SUPPRESSED" | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
- uses: actions/cache/save@v3 | |
if: always() | |
with: | |
path: | | |
~/.cache/vcpkg | |
~/.cache/bin | |
key: vcpkg-${{ env.vcpkg_SHA }}-sanitize-${{ matrix.sanitizer }}-${{ hashFiles('vcpkg.json') }} | |
- name: -fsanitize=${{matrix.sanitizer}} / build | |
run: cmake --build "${{runner.temp}}/build" | |
- name: -fsanitize=${{matrix.sanitizer}} / test | |
working-directory: "${{runner.temp}}/build" | |
env: | |
ASAN_OPTIONS: detect_leaks=1:color=always | |
LSAN_OPTIONS: report_objects=1 | |
TSAN_OPTIONS: halt_on_error=1:second_deadlock_stack=1 | |
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1 | |
run: ctest --output-on-failure --timeout=60s |