Skip to content

CI: add blocking GCC ASan+UBSan job running the quick test suite #45

CI: add blocking GCC ASan+UBSan job running the quick test suite

CI: add blocking GCC ASan+UBSan job running the quick test suite #45

Workflow file for this run

name: C/C++ CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
ubuntu:
strategy:
fail-fast: false
matrix:
build_type: [Debug, Release]
compiler:
- { name: gcc, cc: gcc, cxx: g++ }
- { name: clang, cc: clang, cxx: clang++ }
runs-on: ubuntu-latest
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt update
sudo apt install -y libncurses-dev libxmu-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxtst-dev clang
- name: build and install SDL3
# ubuntu-latest (24.04 as of writing) has no libsdl3-dev package; SDL3
# only landed in Ubuntu starting with 25.04. Build the pinned stable
# release from source instead of depending on a distro package.
run: |
curl -fsSL -o /tmp/SDL3.tar.gz \
https://github.com/libsdl-org/SDL/releases/download/release-3.4.12/SDL3-3.4.12.tar.gz
tar -xzf /tmp/SDL3.tar.gz -C /tmp
cmake -B /tmp/SDL3-build -S /tmp/SDL3-3.4.12 -DCMAKE_BUILD_TYPE=Release
cmake --build /tmp/SDL3-build -j$(nproc)
sudo cmake --install /tmp/SDL3-build
sudo ldconfig
- name: configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: build
run: cmake --build build -j$(nproc)
- name: test
run: ctest --test-dir build --output-on-failure --label-exclude long -j$(nproc)
sanitizers:
# ASan + UBSan leg: build the kernel and skelconq with
# -fsanitize=address,undefined on RelWithDebInfo and run the quick ctest
# lane (the same headless skelconq runs the other legs use) under the
# sanitizers. GCC is used because it is what reproduces locally; Clang
# would work identically. The UIs are left off: the test lane only drives
# skelconq, so building cconq/sdlconq under the sanitizers would add build
# time (incl. SDL3-from-source) without adding sanitizer coverage.
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
# detect_leaks=0: the kernel allocates via xmalloc and frees almost
# nothing by design, so LSan would drown the real signal. Leak checking
# is deferred until the planned de-globalization gives the kernel a
# teardown path (MODERNIZATION-PLAN.md §9). abort_on_error makes any
# sanitizer finding raise SIGABRT so test/common.sh's crash check catches
# it for every module, playable or not.
ASAN_OPTIONS: detect_leaks=0:abort_on_error=1
# halt_on_error=1: UB findings fail the run rather than being logged and
# skipped past.
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:abort_on_error=1
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt update
sudo apt install -y libasan8 libubsan1
- name: configure
# RelWithDebInfo: optimized enough that the 2-5x sanitizer slowdown stays
# tolerable, still -g for readable reports. TIMEOUT_SCALE widens the test
# timeouts (CTest properties and test/common.sh's per-game bound) for the
# slower sanitized runs, this build only.
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DXCONQ_SANITIZE=address,undefined
-DXCONQ_TEST_TIMEOUT_SCALE=3
-DXCONQ_UI_CURSES=OFF -DXCONQ_UI_SDL=OFF
- name: build
run: cmake --build build -j$(nproc)
- name: test
run: ctest --test-dir build --output-on-failure --label-exclude long -j$(nproc)
macos:
runs-on: macos-latest
# sdlconq also links directly against Xlib/Xmu/Xext (see sdl/CMakeLists.txt),
# which needs XQuartz; that's real porting work, so it's scoped out here and
# the top-level CMakeLists' X11_FOUND gate just skips the SDL UI. See
# MODERNIZATION-PLAN.md §3.2 note. continue-on-error stays on until this job
# has a track record of being green.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: install dependencies
# curses ships with the OS; sdl3 is the only thing to fetch (SDL 3, not
# the old sdl12-compat shim -- see MODERNIZATION-PLAN.md §4).
run: brew install sdl3
- name: configure
# Homebrew's prefix (/opt/homebrew on Apple Silicon runners) isn't on
# CMake's built-in search path, so find_package(SDL3) needs a hint.
run: cmake -B build -DCMAKE_PREFIX_PATH=$(brew --prefix)
- name: build
run: cmake --build build -j$(getconf _NPROCESSORS_ONLN)
- name: test
run: ctest --test-dir build --output-on-failure --label-exclude long -j$(getconf _NPROCESSORS_ONLN)