From 9f1796274b471fbe9b4fb463dde2579da6795c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 9 Jan 2025 19:41:55 -0300 Subject: [PATCH] ci: add builds with all supported sanitizers. This way, tests will be run with sanitizers as well. Since including a sanitizer in static binaries isn't recommended (doesn't work with LLVM, with GCC requires a special flag), we include the sanitizer flags in the same matrix group as linking flags. --- .github/workflows/build.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bb6ac1..f629b17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: container: image: ${{ matrix.distro.image }} env: - LDFLAGS: ${{ matrix.linking.ldflags }} + LDFLAGS: ${{ matrix.link-n-sane.ldflags }} CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} strategy: @@ -24,9 +24,13 @@ jobs: compiler: - { cc: gcc, cxx: g++ } - { cc: clang, cxx: clang++ } - linking: - - { ldflags: "" } - - { ldflags: "-static" } + link-n-sane: + - { ldflags: "", sanitizer: "none" } + - { ldflags: "-static", sanitizer: "none" } + - { sanitizer: "address,undefined" } + - { sanitizer: "thread" } + - { sanitizer: "memory" } + - { sanitizer: "leak" } options: - { pcie_opt: "true" } - { pcie_opt: "false" } @@ -37,7 +41,7 @@ jobs: with: submodules: true - name: Configure - run: meson setup --buildtype release --werror -Dpcie_opt=${{ matrix.options.pcie_opt }} build || cat build/meson-logs/meson-log.txt /nonexistent + run: meson setup --buildtype release --werror -Dpcie_opt=${{ matrix.options.pcie_opt }} -Db_sanitize=${{ matrix.link-n-sane.sanitizer }} build || cat build/meson-logs/meson-log.txt /nonexistent - name: Build run: ninja -C build - name: Run tests