未验证 提交 4c1ff854 编写于 作者: R Roman Donchenko 提交者: GitHub

Simplify Python linter workflows (#6577)

Use pipx (preinstalled on GitHub-hosted runners), which takes care of
virtual environments for us. Remove the apt-get commands; we don't
actually need the packages that they're installing.
上级 5949ac3d
......@@ -18,16 +18,11 @@ jobs:
CHANGED_FILES="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $CHANGED_FILES ]]; then
sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv
python3 -m venv .env
. .env/bin/activate
pip install -U pip wheel setuptools
pip install bandit
pipx install bandit
echo "Bandit version: "$(bandit --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
bandit -a file --ini .bandit $CHANGED_FILES
deactivate
else
echo "No files with the \"py\" extension found"
fi
......@@ -28,11 +28,7 @@ jobs:
UPDATED_DIRS="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $UPDATED_DIRS ]]; then
sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv
python3 -m venv .env
. .env/bin/activate
pip install -U pip wheel setuptools
pip install $(egrep "black.*" ./cvat-cli/requirements/development.txt)
pipx install $(egrep "black.*" ./cvat-cli/requirements/development.txt)
echo "Black version: "$(black --version)
echo "The dirs will be checked: $UPDATED_DIRS"
......@@ -40,7 +36,6 @@ jobs:
for DIR in $UPDATED_DIRS; do
black --check --diff $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true
done
deactivate
exit $EXIT_CODE
else
echo "No files with the \"py\" extension found"
......
......@@ -25,11 +25,7 @@ jobs:
UPDATED_DIRS="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $UPDATED_DIRS ]]; then
sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv
python3 -m venv .env
. .env/bin/activate
pip install -U pip wheel setuptools
pip install $(egrep "isort.*" ./cvat-cli/requirements/development.txt)
pipx install $(egrep "isort.*" ./cvat-cli/requirements/development.txt)
echo "isort version: $(isort --version-number)"
echo "The dirs will be checked: $UPDATED_DIRS"
......@@ -37,7 +33,6 @@ jobs:
for DIR in $UPDATED_DIRS; do
isort --check $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true
done
deactivate
exit $EXIT_CODE
else
echo "No files with the \"py\" extension found"
......
......@@ -19,17 +19,15 @@ jobs:
CHANGED_FILES="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $CHANGED_FILES ]]; then
sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv
python3 -m venv .env
. .env/bin/activate
pip install -U pip wheel setuptools
pip install $(egrep "pylint.*==.*" ./cvat/requirements/development.txt)
pip install $(egrep "django==.*" ./cvat/requirements/base.txt)
pipx install $(egrep "^pylint==" ./cvat/requirements/development.txt)
pipx inject pylint \
$(egrep "^pylint-.+==" ./cvat/requirements/development.txt) \
$(egrep "^django==" ./cvat/requirements/base.txt)
echo "Pylint version: "$(pylint --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
pylint $CHANGED_FILES
deactivate
else
echo "No files with the \"py\" extension found"
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册