Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add sanitizers to ci workflow #4462

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ jobs:
build-type: [Debug, Release]
compiler: [{ cxx: g++, c: gcc }]
cxx_flags: ["-Werror"]
sanitizers: ["NoSanitizers"]
include:
- container: "alpine-dev:latest"
build-type: Debug
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
env:
Expand All @@ -72,6 +80,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true

- name: Prepare Environment
run: |
uname -a
Expand All @@ -89,6 +98,7 @@ jobs:
df -h
touch /mnt/foo
ls -la /mnt/foo

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

Expand All @@ -99,10 +109,35 @@ jobs:
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this step for sanitizers but not for alpine build that uses clang?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets make this a separate step to just install clang

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because alpine comes prebundled with clang

lets make this a separate step to just install clang

IMO this is bad as well. It should be prebundled and should go under container foundtry and not as part of this workflow file. See: https://github.com/romange/container-foundry/blob/main/u24.04-dev.Dockerfile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which clang

- 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.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
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
cmake -B ${GITHUB_WORKSPACE}/build \
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
Expand All @@ -112,7 +147,10 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}} -no-pie" -DWITH_AWS:BOOL=OFF \
-DHELIO_STACK_CHECK:STRING=4096 \
-DWITH_ASAN="${ASAN}" \
-DWITH_USAN="${USAN}" \
-L

cd ${GITHUB_WORKSPACE}/build && pwd
du -hcs _deps/

Expand Down Expand Up @@ -149,7 +187,6 @@ jobs:

gdb -ix ./init.gdb --batch -ex r --args ./dragonfly_test --force_epoll
FLAGS_force_epoll=true GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 timeout 20m ctest -V -L DFLY

echo "Finished running tests with --force_epoll"

echo "Running tests with --cluster_mode=emulated"
Expand All @@ -161,6 +198,7 @@ jobs:
timeout 5m ./dragonfly_test
timeout 5m ./json_family_test --jsonpathv2=false
timeout 5m ./tiered_storage_test --vmodule=db_slice=2 --logtostderr

- name: Upload unit logs on failure
if: failure()
uses: actions/upload-artifact@v4
Expand Down
107 changes: 0 additions & 107 deletions .github/workflows/daily-sanitizers.yml

This file was deleted.

Loading