From 1e796477dc2dcada14938e391763a4bb2a7a0cf7 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 11 Jun 2022 16:56:34 -0500 Subject: [PATCH] build: add sanitizer CI runs when libtransmission-test changes (#3260) --- .github/workflows/sanitizer-clang.yml | 64 +++++++++++++++++++++++++++ .github/workflows/sanitizer-gcc.yml | 64 +++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 .github/workflows/sanitizer-clang.yml create mode 100644 .github/workflows/sanitizer-gcc.yml diff --git a/.github/workflows/sanitizer-clang.yml b/.github/workflows/sanitizer-clang.yml new file mode 100644 index 000000000..33583a671 --- /dev/null +++ b/.github/workflows/sanitizer-clang.yml @@ -0,0 +1,64 @@ +name: sanitizer-test-clang +on: + push: + paths: + - CMakeLists.txt + - libtransmission/** + - tests/** + - utils/** + pull_request: + types: [opened, reopened] + paths: + - CMakeLists.txt + - libtransmission/** + - tests/** + - utils/** +env: + GTEST_OUTPUT: xml:./ +jobs: + sanitizer-test-clang + runs-on: ubuntu-22.04 + steps: + - name: Prepare + run: | + set -ex + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + gettext \ + libcurl4-openssl-dev \ + libdeflate-dev \ + libevent-dev \ + libfmt-dev \ + libminiupnpc-dev \ + libnatpmp-dev \ + libpsl-dev \ + libssl-dev \ + ninja-build + - name: Checkout + uses: actions/checkout@v3 + with: + path: src + submodules: recursive + - name: Configure + run: | + cmake \ + -S src \ + -B obj \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER='clang++' \ + -DCMAKE_CXX_FLAGS='-gdwarf-4 -fno-omit-frame-pointer -fsanitize=address,leak,undefined' \ + -DCMAKE_C_COMPILER='clang' \ + -DCMAKE_C_FLAGS='-gdwarf-4 -fno-omit-frame-pointer -fsanitize=address,leak,undefined' \ + -DCMAKE_INSTALL_PREFIX=pfx \ + -DENABLE_CLI=OFF \ + -DENABLE_GTK=OFF \ + -DENABLE_QT=OFF \ + `#-DENABLE_WEB=ON` + - name: Build + run: cmake --build obj --config Debug --target libtransmission-test transmission-show + - name: Test + run: cmake -E chdir obj ctest --build-config Debug --output-on-failure diff --git a/.github/workflows/sanitizer-gcc.yml b/.github/workflows/sanitizer-gcc.yml new file mode 100644 index 000000000..60f10de39 --- /dev/null +++ b/.github/workflows/sanitizer-gcc.yml @@ -0,0 +1,64 @@ +name: sanitizer-test-gcc +on: + push: + paths: + - CMakeLists.txt + - libtransmission/** + - tests/** + - utils/** + pull_request: + types: [opened, reopened] + paths: + - CMakeLists.txt + - libtransmission/** + - tests/** + - utils/** +env: + GTEST_OUTPUT: xml:./ +jobs: + sanitizer-test-gcc + runs-on: ubuntu-22.04 + steps: + - name: Prepare + run: | + set -ex + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + ca-certificates \ + cmake \ + g++ \ + gettext \ + libcurl4-openssl-dev \ + libdeflate-dev \ + libevent-dev \ + libfmt-dev \ + libminiupnpc-dev \ + libnatpmp-dev \ + libpsl-dev \ + libssl-dev \ + ninja-build + - name: Checkout + uses: actions/checkout@v3 + with: + path: src + submodules: recursive + - name: Configure + run: | + cmake \ + -S src \ + -B obj \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER='g++' \ + -DCMAKE_CXX_FLAGS='-gdwarf-4 -fno-omit-frame-pointer -fsanitize=address,pointer-compare,pointer-subtract,leak,undefined' \ + -DCMAKE_C_COMPILER='gcc' \ + -DCMAKE_C_FLAGS='-gdwarf-4 -fno-omit-frame-pointer -fsanitize=address,pointer-compare,pointer-subtract,leak,undefined' \ + -DCMAKE_INSTALL_PREFIX=pfx \ + -DENABLE_CLI=OFF \ + -DENABLE_GTK=OFF \ + -DENABLE_QT=OFF \ + `#-DENABLE_WEB=ON` + - name: Build + run: cmake --build obj --config Debug --target libtransmission-test transmission-show + - name: Test + run: cmake -E chdir obj ctest --build-config Debug --output-on-failure