ddnet/.github/workflows/clang-sanitizer.yml
ChillerDragon 7180ef1ec1 Fix glew CI error
```
 [1/322] Building C object CMakeFiles/glew.dir/src/engine/external/glew/glew.c.o
FAILED: CMakeFiles/glew.dir/src/engine/external/glew/glew.c.o
/usr/bin/cc -DGLEW_STATIC -I/home/runner/work/ddnet/ddnet/src/engine/external/glew -g -fdiagnostics-color=always -fstack-protector-strong -fno-exceptions -fsigned-char -Wno-implicit-function-declaration -MD -MT CMakeFiles/glew.dir/src/engine/external/glew/glew.c.o -MF CMakeFiles/glew.dir/src/engine/external/glew/glew.c.o.d -o CMakeFiles/glew.dir/src/engine/external/glew/glew.c.o -c /home/runner/work/ddnet/ddnet/src/engine/external/glew/glew.c
In file included from /home/runner/work/ddnet/ddnet/src/engine/external/glew/glew.c:34:
/home/runner/work/ddnet/ddnet/src/engine/external/glew/GL/glew.h:1205:14: fatal error: GL/glu.h: No such file or directory
 1205 | #    include <GL/glu.h>
      |              ^~~~~~~~~~
compilation terminated.
[2/322] Building C object CMakeFiles/wavpack.dir/src/engine/external/wavpack/float.c.o
```
2024-09-27 12:13:23 +08:00

69 lines
2.5 KiB
YAML

name: Check ASan & UBSan
on:
push:
branches-ignore:
- gh-readonly-queue/**
- master
pull_request:
merge_group:
jobs:
check-clang-san:
runs-on: ubuntu-20.04
env:
CARGO_HTTP_MULTIPLEXING: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare linux
run: |
sudo apt-get update -y
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libvulkan-dev glslang-tools spirv-tools libglew-dev -y
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build with ASan and UBSan
run: |
mkdir clang-sanitizer
cd clang-sanitizer
export CC=clang
export CXX=clang++
export CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer"
export CFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer"
cmake -DCMAKE_BUILD_TYPE=Debug -DHEADLESS_CLIENT=ON -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
make -j"$(nproc)"
- name: Run server and headless client with ASan and UBSan
run: |
cd clang-sanitizer
export UBSAN_OPTIONS=suppressions=./ubsan.supp:log_path=./SAN:print_stacktrace=1:halt_on_errors=0
export ASAN_OPTIONS=log_path=./SAN:print_stacktrace=1:check_initialization_order=1:detect_leaks=1:halt_on_errors=0
export LSAN_OPTIONS=suppressions=./lsan.supp
./DDNet "cl_download_skins 0;quit" || true
./DDNet-Server shutdown || true
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
then
cat ./SAN.*
exit 1
fi
- name: Run unit tests with ASan and UBSan
run: |
cd clang-sanitizer
cmake --build . --config Debug --target run_cxx_tests
# Rust tests work locally, but still not in CI, even with the same directory
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
then
cat ./SAN.*
exit 1
fi
- name: Run integration tests with ASan and UBSan
run: |
cd clang-sanitizer
make run_integration_tests
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
then
cat ./SAN.*
exit 1
fi