From de4338233cab2c62489f9c8864d70b972c7cf59d Mon Sep 17 00:00:00 2001 From: frapank Date: Tue, 15 Sep 2026 17:28:35 +0200 Subject: [PATCH] Add workflow --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b0ffa42 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI +on: [push, pull_request] + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install "clang-format==21.*" + - run: clang-format --dry-run -Werror src/*.cpp src/*.hpp + + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + compiler: [g++, clang++] + build_type: [Debug, Release] + steps: + - uses: actions/checkout@v4 + - name: Configure + run: | + cmake -B build \ + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DCMAKE_CXX_FLAGS="-Wall -Wextra" + - name: Build + run: cmake --build build -j + + sanitizers: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sanitizer: ["address,undefined", "thread"] + steps: + - uses: actions/checkout@v4 + - name: Configure + run: | + cmake -B build -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer -g" \ + -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=${{ matrix.sanitizer }}" + - name: Build + run: cmake --build build -j + - name: Smoke run + env: + ASAN_OPTIONS: detect_leaks=1:exitcode=42 + UBSAN_OPTIONS: halt_on_error=1:exitcode=42 + TSAN_OPTIONS: exitcode=42 + run: | + timeout 30 ./build/unixboard < /dev/null > /dev/null || code=$? + if [ "${code:-0}" = 42 ]; then echo "sanitizer reported an error"; exit 1; fi