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

Merged
merged 18 commits into from
Jan 22, 2025
Merged

chore: add sanitizers to ci workflow #4462

merged 18 commits into from
Jan 22, 2025

Conversation

kostasrim
Copy link
Contributor

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.

  • remove daily sanitizers workflow
  • add sanitizers to ci workflow

@kostasrim kostasrim self-assigned this Jan 15, 2025
@kostasrim
Copy link
Contributor Author

@kostasrim kostasrim requested a review from adiholden January 15, 2025 12:57
.github/workflows/ci.yml Outdated Show resolved Hide resolved
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
Copy link
Collaborator

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
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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

please follow up on this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will, let it be for now

if: matrix.sanitizers == 'Sanitizers'
run: |
cd ${GITHUB_WORKSPACE}/build
ctest -V -L DFLY
Copy link
Collaborator

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"?

Copy link
Contributor Author

@kostasrim kostasrim Jan 16, 2025

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) 🤷

Copy link
Collaborator

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?

Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

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 )

  1. removes rows and simplifies
  2. 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

-DWITH_ASAN=ON \
-DWITH_USAN=ON \
-DCMAKE_C_FLAGS=-Wno-error=unused-command-line-argument \
-DCMAKE_CXX_FLAGS=-Wno-error=unused-command-line-argument
Copy link
Collaborator

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

mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
Copy link
Collaborator

Choose a reason for hiding this comment

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

matrix.build-type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice!

echo "-----------------------------"
mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
cmake .. \
Copy link
Collaborator

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

Copy link
Contributor Author

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 )

Copy link
Collaborator

Choose a reason for hiding this comment

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

compiler: { cxx: clang++, c: clang }
cxx_flags: ""
sanitizers: "Sanitizers"
exclude:
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 you add it to the matrix.containers list if you exclude it here?

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 we would generate a bunch more job. exclude is filter on the matrix level. GH action syntax is missleading here :(

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try

@kostasrim kostasrim force-pushed the kpr6 branch 2 times, most recently from 43b58cd to a5f49a8 Compare January 16, 2025 12:04
@kostasrim kostasrim force-pushed the kpr6 branch 2 times, most recently from 0de668e to bcb0377 Compare January 16, 2025 14:17
@kostasrim kostasrim requested a review from adiholden January 20, 2025 07:25
@adiholden
Copy link
Collaborator

@kostasrim please rebase the branch so there will be no conflict. I will approve after that

@kostasrim
Copy link
Contributor Author

@kostasrim please rebase the branch so there will be no conflict. I will approve after that

done

@kostasrim kostasrim closed this Jan 22, 2025
@kostasrim kostasrim reopened this Jan 22, 2025
@romange romange merged commit 4a2f2e3 into main Jan 22, 2025
19 of 20 checks passed
@romange romange deleted the kpr6 branch January 22, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants