mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: add sanitizers to ci workflow (#4462)
* chore: add sanitizers to ci workflow --------- Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
parent
d44eec2285
commit
4a2f2e3d04
2 changed files with 39 additions and 107 deletions
39
.github/workflows/ci.yml
vendored
39
.github/workflows/ci.yml
vendored
|
@ -44,10 +44,19 @@ jobs:
|
||||||
build-type: [Debug, Release]
|
build-type: [Debug, Release]
|
||||||
compiler: [{ cxx: g++, c: gcc }]
|
compiler: [{ cxx: g++, c: gcc }]
|
||||||
cxx_flags: ["-Werror"]
|
cxx_flags: ["-Werror"]
|
||||||
|
sanitizers: ["NoSanitizers"]
|
||||||
include:
|
include:
|
||||||
- container: "alpine-dev:latest"
|
- container: "alpine-dev:latest"
|
||||||
build-type: Debug
|
build-type: Debug
|
||||||
compiler: { cxx: clang++, c: clang }
|
compiler: { cxx: clang++, c: clang }
|
||||||
|
cxx_flags: ""
|
||||||
|
sanitizers: "NoSanitizers"
|
||||||
|
- container: "ubuntu-dev:24"
|
||||||
|
build-type: Debug
|
||||||
|
compiler: { cxx: clang++, c: clang }
|
||||||
|
# https://maskray.me/blog/2023-08-25-clang-wunused-command-line-argument (search for compiler-rt)
|
||||||
|
cxx_flags: "-Wno-error=unused-command-line-argument"
|
||||||
|
sanitizers: "Sanitizers"
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
|
@ -71,6 +80,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Prepare Environment
|
- name: Prepare Environment
|
||||||
run: |
|
run: |
|
||||||
uname -a
|
uname -a
|
||||||
|
@ -88,6 +98,7 @@ jobs:
|
||||||
df -h
|
df -h
|
||||||
touch /mnt/foo
|
touch /mnt/foo
|
||||||
ls -la /mnt/foo
|
ls -la /mnt/foo
|
||||||
|
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
uses: mozilla-actions/sccache-action@v0.0.7
|
uses: mozilla-actions/sccache-action@v0.0.7
|
||||||
|
|
||||||
|
@ -98,10 +109,35 @@ jobs:
|
||||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
|
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
|
||||||
|
|
||||||
|
- name: Install clang
|
||||||
|
if: matrix.sanitizers == 'Sanitizers'
|
||||||
|
run: |
|
||||||
|
# TODO remove this once the weekly is done
|
||||||
|
apt -y update
|
||||||
|
apt -y upgrade
|
||||||
|
apt install -y clang
|
||||||
|
which clang
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||||
run: |
|
run: |
|
||||||
|
echo "ulimit is"
|
||||||
|
ulimit -s
|
||||||
|
echo "-----------------------------"
|
||||||
|
echo "disk space is:"
|
||||||
|
df -h
|
||||||
|
echo "-----------------------------"
|
||||||
|
|
||||||
|
export ASAN="OFF"
|
||||||
|
export USAN="OFF"
|
||||||
|
|
||||||
|
if [ '${{matrix.sanitizers}}' = 'Sanitizers' ]; then
|
||||||
|
echo "ASAN/USAN"
|
||||||
|
export ASAN="ON"
|
||||||
|
export USAN="ON"
|
||||||
|
fi
|
||||||
|
|
||||||
# -no-pie to disable address randomization so we could symbolize stacktraces
|
# -no-pie to disable address randomization so we could symbolize stacktraces
|
||||||
cmake -B ${GITHUB_WORKSPACE}/build \
|
cmake -B ${GITHUB_WORKSPACE}/build \
|
||||||
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
|
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
|
||||||
|
@ -110,7 +146,10 @@ jobs:
|
||||||
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
|
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
||||||
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}} -no-pie" -DWITH_AWS:BOOL=OFF \
|
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}} -no-pie" -DWITH_AWS:BOOL=OFF \
|
||||||
|
-DWITH_ASAN="${ASAN}" \
|
||||||
|
-DWITH_USAN="${USAN}" \
|
||||||
-L
|
-L
|
||||||
|
|
||||||
cd ${GITHUB_WORKSPACE}/build && pwd
|
cd ${GITHUB_WORKSPACE}/build && pwd
|
||||||
du -hcs _deps/
|
du -hcs _deps/
|
||||||
|
|
||||||
|
|
107
.github/workflows/daily-sanitizers.yml
vendored
107
.github/workflows/daily-sanitizers.yml
vendored
|
@ -1,107 +0,0 @@
|
||||||
name: daily-sanitizers
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 4 * * *' # run at 4 AM UTC
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: [ubuntu-24.04]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
container: ["ubuntu-dev:24"]
|
|
||||||
build-type: [Debug]
|
|
||||||
compiler: [{ cxx: clang++, c: clang }]
|
|
||||||
# TODO bring it back when warnings on clang are fixed
|
|
||||||
# cxx_flags: ["-Werror"]
|
|
||||||
timeout-minutes: 90
|
|
||||||
env:
|
|
||||||
SCCACHE_GHA_ENABLED: "true"
|
|
||||||
SCCACHE_CACHE_SIZE: 6G
|
|
||||||
SCCACHE_ERROR_LOG: /tmp/sccache_log.txt
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: ghcr.io/romange/${{ matrix.container }}
|
|
||||||
options: --security-opt seccomp=unconfined
|
|
||||||
credentials:
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Run sccache-cache
|
|
||||||
uses: mozilla-actions/sccache-action@v0.0.7
|
|
||||||
|
|
||||||
- name: Configure Cache Env
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
|
||||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
|
|
||||||
|
|
||||||
- name: Prepare Environment
|
|
||||||
run: |
|
|
||||||
uname -a
|
|
||||||
cmake --version
|
|
||||||
mkdir -p ${GITHUB_WORKSPACE}/build
|
|
||||||
|
|
||||||
echo "===================Before freeing up space ============================================"
|
|
||||||
df -h
|
|
||||||
rm -rf /hostroot/usr/share/dotnet
|
|
||||||
rm -rf /hostroot/usr/local/share/boost
|
|
||||||
rm -rf /hostroot/usr/local/lib/android
|
|
||||||
rm -rf /hostroot/opt/ghc
|
|
||||||
echo "===================After freeing up space ============================================"
|
|
||||||
df -h
|
|
||||||
|
|
||||||
- name: Configure & Build
|
|
||||||
run: |
|
|
||||||
apt -y update
|
|
||||||
apt -y upgrade
|
|
||||||
apt install -y clang
|
|
||||||
which clang
|
|
||||||
echo "ulimit is"
|
|
||||||
ulimit -s
|
|
||||||
echo "-----------------------------"
|
|
||||||
echo "disk space is:"
|
|
||||||
df -h
|
|
||||||
echo "-----------------------------"
|
|
||||||
mkdir -p $GITHUB_WORKSPACE/build
|
|
||||||
cd $GITHUB_WORKSPACE/build
|
|
||||||
cmake .. \
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
|
||||||
-GNinja \
|
|
||||||
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \
|
|
||||||
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
|
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
|
|
||||||
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
|
|
||||||
-DWITH_ASAN=ON \
|
|
||||||
-DWITH_USAN=ON \
|
|
||||||
-DCMAKE_C_FLAGS=-Wno-error=unused-command-line-argument \
|
|
||||||
-DCMAKE_CXX_FLAGS=-Wno-error=unused-command-line-argument
|
|
||||||
# https://maskray.me/blog/2023-08-25-clang-wunused-command-line-argument (search for compiler-rt)
|
|
||||||
|
|
||||||
ninja src/all
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: |
|
|
||||||
cd $GITHUB_WORKSPACE/build
|
|
||||||
ctest -V -L DFLY
|
|
||||||
|
|
||||||
- name: Send notifications on failure
|
|
||||||
if: failure() && github.ref == 'refs/heads/main'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
job_link="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
|
||||||
message="Daily sanitizers failed.\\n Job Link: ${job_link}\\n"
|
|
||||||
|
|
||||||
curl -s \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
'${{ secrets.GSPACES_BOT_DF_BUILD }}' \
|
|
||||||
-d '{"text": "'"${message}"'"}'
|
|
Loading…
Add table
Add a link
Reference in a new issue