Set up clang-format github action#538
Conversation
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #538 +/- ##
============================================
- Coverage 70.20% 70.19% -0.02%
============================================
Files 109 109
Lines 59913 59916 +3
============================================
- Hits 42064 42056 -8
- Misses 17849 17860 +11
|
zuiderkwast
left a comment
There was a problem hiding this comment.
We can use this action to avoid implementing this: https://github.com/jidicula/clang-format-action
Then the job becomes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Run clang-format style check (.c and .h)
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0
with:
check-path: 'src'
|
@bjosv PTAL |
|
We have been using |
Can we add a README for how to run this locally if we use some 3P validator. I don't want to have to submit a "dummy" PR to check the format. |
Let's add it in CONTRIBUTING.md? |
This action doesn't seem to honor our clang-format settings? https://github.com/valkey-io/valkey/actions/runs/9211589156/job/25341302397?pr=538 any tips? |
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
|
@bjosv can you please take a look at this PR when you get a chance? I suspect that |
|
I have only used it in non-valkey repos sofar, but we will get it up and running in libvalkey soon. but I also get similar changes when running manually in the repo, like: Should |
|
In your initial commit where the clang-format was manually installed on a ubuntu-latest (i.e. ubuntu-22.04) you probably got clang-format-14. Not sure if that is our problem though.. |
|
Thanks @bjosv! The below change looks weird to me. I haven't figured a way to tell clang-format to remove the spaces aroud "&". All the styles I've tried left spaces around "&" with or without a .clang-format. I think I will go back to installing my own clang-format for now. Don't want to leave this action hanging for too long.
|
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
This seems fixed in clang-format-17, but I couldn't find anything in release notes.. Then, we have another issue. The works a lot better, but still.. there are some few additional changes needed. |
Thanks @bjosv. That makes a lot of sense. Let me try out jidicula/clang-format-action with version 18 again. |
Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
|
So I ended up using a custom action.
[Will add to CONTRIBUTING.md] How to run clang-format-check action locally
|
|
Nice!
I don't think the action can do that and it seems helpful. It only logs the warnings and gives a list of files in the job summary. We could also add a make target like |
That is a good idea. Let me merge this one first and work on improving the "developer" experience in a separate PR. need to do some research first. |
Follow up of #323