-
Notifications
You must be signed in to change notification settings - Fork 711
infra: add griffe to public-symbols check CI #4633
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
OVERALL_EXIT_CODE=0 | ||
BRANCH_TO_COMPARE="main" | ||
GRIFFE_CMD="griffe check -v -a $BRANCH_TO_COMPARE " | ||
|
||
run_griffe_check() { | ||
local package_spec="$1" | ||
local package_name | ||
local search_path="" | ||
|
||
if [[ "$package_spec" == *"/"* ]]; then | ||
search_path=$(echo "$package_spec" | cut -d'/' -f1) | ||
package_name=$(echo "$package_spec" | cut -d'/' -f2) | ||
$GRIFFE_CMD -s "$search_path" "$package_name" | ||
else | ||
package_name="$package_spec" | ||
$GRIFFE_CMD "$package_name" | ||
fi | ||
} | ||
|
||
while read -r package; do | ||
if ! run_griffe_check "$package"; then | ||
OVERALL_EXIT_CODE=1 | ||
fi | ||
done < <(python "$(dirname "$0")/eachdist.py" list) | ||
|
||
exit $OVERALL_EXIT_CODE |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,11 +309,16 @@ commands_post = | |
docker-compose down -v | ||
|
||
[testenv:public-symbols-check] | ||
basepython: python3 | ||
recreate = True | ||
allowlist_externals = | ||
{toxinidir}/scripts/griffe_check.sh | ||
deps = | ||
GitPython==3.1.40 | ||
griffe==1.7.3 | ||
toml | ||
commands = | ||
; griffe check before to fail fast if there are any issues | ||
{toxinidir}/scripts/griffe_check.sh | ||
python {toxinidir}/scripts/public_symbols_checker.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this catch anything than griffe won't? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know, to be honest. I left it here to keep what we have now 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we can run both for a release and then drop the custom one if it doesn't raise anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xrmx I think the main difference is that the public_symbols_checker.py script will check for additions. Griffe will be checking for removed/moved symbols There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
|
||
|
||
[testenv:generate-workflows] | ||
|
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.
sorry my bash isn't that great. when tox calls with no arguments, will it check all directories? This might get annoying for test directories.
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, tests will also be checked 😓. I agree it will be annoying. Let me see if we can exclude them.
Uh oh!
There was an error while loading. Please reload this page.
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.
thanks for the approval, but I'll put it in draft to write the check using griffe Python API. It will be easier to maintain.