-
Notifications
You must be signed in to change notification settings - Fork 994
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: kostas <[email protected]>
Signed-off-by: kostas <[email protected]>
.github/workflows/ci.yml
Outdated
build-type: [Debug, Release] | ||
compiler: [{ cxx: g++, c: gcc }] | ||
cxx_flags: ["-Werror"] | ||
sanitizers: ["Plain"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename Plain to NoSanitizers.
Its easier to understand when looking on the actions this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I would use "ON" / "OFF" this way you can use matrix.sanitizers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to use ON/OFF
because it has no meaning when you read it https://github.com/dragonflydb/dragonfly/actions/runs/12788815584/job/35650888951
I used "Plain" for "Plain Build" but "NoSanitizers" is better so I will use that
.github/workflows/ci.yml
Outdated
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \ | ||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ | ||
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line appears twice
run: | | ||
apt -y update | ||
apt -y upgrade | ||
apt install -y clang |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.github/workflows/ci.yml
Outdated
if: matrix.sanitizers == 'Sanitizers' | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/build | ||
ctest -V -L DFLY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reason for different unit test run for sanitizers and the "plain"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run unit tests with epoll and without and also some more other manually (for the non sanitizers build) 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are stating what we are doing. I can see that and therefor I ask what is the reason for this?
Why not run the same for both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if you unite the step and run the same tests for both you will not need the matrix.sanitizers at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helio is a third party lib, not part of dragonfly. We are using sanitizers to test dragonfly and not helio's proactor (iouring or epoll). Furthermore, you are trying to to bring everything under the same umbrella. I don't think this is a good thing. The end goal would be to have separate actions, one for normal builds and one for sanitizers
. That way, as we change things, workflows are separate and self contained (similar to what we do with regression tests, that we have action which we parametarize).
Anyway, these are not important for now. I will unify them for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that unifying the steps fro different builds (similarly to code quadruplication )
- removes rows and simplifies
- if we need to do changes we dont need to remember to fix both
Unlsess there is a reason to not unify them I dont see why not.
We want the sanitizers to run on different flows, there is a reason we have in the build running tests with different flags for example cluster emulated / lock on hash tag. If we run the sanitizers on this flows as well we might catch different failures.
Similar to unifying the bulild step, you see that we added some params to the build f.e HELIO_STACK_CHECK that we forgot to add to the sanitizers bulid. once we unify this there is nothing to remember
.github/workflows/ci.yml
Outdated
-DWITH_ASAN=ON \ | ||
-DWITH_USAN=ON \ | ||
-DCMAKE_C_FLAGS=-Wno-error=unused-command-line-argument \ | ||
-DCMAKE_CXX_FLAGS=-Wno-error=unused-command-line-argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be passed from matrix.cxx_flags
.github/workflows/ci.yml
Outdated
mkdir -p $GITHUB_WORKSPACE/build | ||
cd $GITHUB_WORKSPACE/build | ||
cmake .. \ | ||
-DCMAKE_BUILD_TYPE=Debug \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matrix.build-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
.github/workflows/ci.yml
Outdated
echo "-----------------------------" | ||
mkdir -p $GITHUB_WORKSPACE/build | ||
cd $GITHUB_WORKSPACE/build | ||
cmake .. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can make only one build step for sanitizers and non sanitizers and control the configure all the flags in under the matrix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another downside of this: [build (alpine-dev:latest, Release, g++, gcc, -Werror, NoSanitizers, OFF, OFF)](https://github.com/dragonflydb/dragonfly/actions/runs/12804933055/job/35700274090?pr=4462#logs)
See https://github.com/dragonflydb/dragonfly/actions/runs/12804933055/job/35700274090?pr=4462
(I will figure out something 😄 -- need to expiriment )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I suggest use https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow to understand what is the correct why to do this
.github/workflows/ci.yml
Outdated
compiler: { cxx: clang++, c: clang } | ||
cxx_flags: "" | ||
sanitizers: "Sanitizers" | ||
exclude: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you add it to the matrix.containers list if you exclude it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we would generate a bunch more job. exclude
is filter
on the matrix
level. GH action syntax is missleading here :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You basically "exclude" all the jobs that run on ubuntu-24
container and are not sanitizers
. Why? Because otherwise we would have a release ubuntu-24
, debug ubuntu-24
, etc. That way you get only one job sanitizers + ubuntu 24 with clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include above is the opposite. it acts as a "decorator" overwritting the matrix value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand include adds and exclude removes. here you remove all the ubuntu-dev:24 defined in the matrix above therefor I think that if you remove it from the matrix it will be enough we will just run them from the include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try
43b58cd
to
a5f49a8
Compare
0de668e
to
bcb0377
Compare
Sanitizers used to run once per day. However with the recent changes and failures we decided to run them as part of each PR. This PR removes the daily run and migrates it as part of the CI/PR workflow.