CI: enforce python 3.6+ with vermin (MR 2002)
Make sure that features requiring a higher python version don't sneak in by accident. It would be nice to add this to test/static_code_analysis.sh, so it is easy to run it locally. But vermin is not packaged in Alpine right now, and given that this should be a rather rarer error, it doesn't seem worth the effort right now. Run silently by default and only in verbose mode if there are errors, because if vermin isn't silent, it will not just point out errors, but describe required python versions for everything it sees. (Copied that part from the bpo CI script, where I had used it as pre-commit hook as it was stuck on 3.5 for some time.)
This commit is contained in:
parent
196186df24
commit
8e3196a42a
|
@ -42,6 +42,16 @@ static-code-analysis:
|
|||
# Note: This script uses CI_PROJECT_DIR
|
||||
- su pmos -c "CI_PROJECT_DIR=$CI_PROJECT_DIR .gitlab/shared-runner_test-pmbootstrap.sh --static-code-analysis"
|
||||
|
||||
vermin:
|
||||
image: alpine:latest
|
||||
stage: checks
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- "apk -q add py3-pip"
|
||||
- "pip3 -q --disable-pip-version-check install vermin"
|
||||
script:
|
||||
- ".gitlab/vermin.sh"
|
||||
|
||||
# MR settings
|
||||
# (Checks for "Allow commits from members who can merge to the target branch")
|
||||
mr-settings:
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh -e
|
||||
_vermin() {
|
||||
if ! vermin -q "$@" >/dev/null 2>&1; then
|
||||
vermin -vv "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
_vermin \
|
||||
-t=3.6- \
|
||||
--backport argparse \
|
||||
--backport configparser \
|
||||
--backport enum \
|
||||
--backport typing \
|
||||
$(find . -name '*.py' \
|
||||
-a -not -path "./.venv/*" \
|
||||
-a -not -path "./venv/*")
|
||||
|
||||
echo "vermin check passed"
|
Loading…
Reference in New Issue