-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add format checker to the CI #120
base: main
Are you sure you want to change the base?
Conversation
Add yaml file for code quality checker
…ed file was found
Hi, thanks a lot! I have not take a look at the code yet, one feedback on the setup we have is that https://github.com/duckdb/extension-ci-tools/blob/main/.github/workflows/TestCITools.yml should likely invoke the formatting workflow, so that directly on this PR that is invoked, and on changes to the formatting script this is still run once so that it's checked to still make sense (where make sense means not exploding). Note that it's possible that adding the test means it would fail, since extension-template might not be formatted properly yet, but that's OK, relevant thing is checking it completes without burning. |
cmake-format -i CMakeLists.txt | ||
# Rule to fix formatting | ||
format-check: | ||
python extension-ci-tools/scripts/format_extension.py |
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.
curious, why L137 uses python
while L140 and L143 uses python3
?
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.
Fair point, using python for all in cff0722
(#120)
@@ -0,0 +1,400 @@ | |||
#!/usr/bin/python |
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.
Maybe I'm too sensitive, I'm not sure whether MIT license should be included
From doc, the copyright notice needs necessary.
(Though I know these two repositories belong to the same organization...)
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 wouldn't be opposed to adding this, but the other scripts in this repo also don't have this in the header. So I think this is up to @carlopi whether this should be added or not.
- name: Generated Check | ||
shell: bash | ||
run: | | ||
git diff --ignore-submodules --exit-code |
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.
nit: newliner
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.
Fix: Dtenwolde@eb48b6e
Thank you so much! |
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
|
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 think you should add a step like:
- uses: actions/checkout@v4
name: Checkout Extension CI tools
with:
path: 'extension-ci-tools'
ref: ${{ inputs.ci_tools_version }}
repository: ${{ inputs.override_ci_tools_repository }}
and add ci_tools_version AND override_ci_tools to the input, AND pass them down on the test invocation so that they are the current branch / current repo.
You can look at how https://github.com/duckdb/extension-ci-tools/blob/main/.github/workflows/_extension_distribution.yml works, or I can take over later.
This PR adds a more extensive formatting checker for extensions and a format check step to the CI.
I copied the
format.py
script from https://github.com/duckdb/duckdb/blob/main/scripts/format.py and renamed it toformat_extension.py
since it has different directories to check. I also added similar Makerules such asformat-check
andformat-fix
. I think keeping the pipeline consistent with the main duckdb repo makes sense for the code quality of extensions. Extension maintainers can always opt out or disable the workflow if they so desire.Two things I am not sure about:
.hpp
files (see below for the strings), but can we enforce that extensions have such a header? I am not sure how strict we should be about this check or if it is even relevant. Curious about your thoughts.I added a PR to the extension-template to trigger this workflow: duckdb/extension-template#99