Extend cleaning for downloaded file names #4097
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Black | |
on: pull_request | |
jobs: | |
Linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: files | |
uses: tj-actions/changed-files@v35.9.2 | |
with: | |
files: | | |
cvat-sdk/**/*.py | |
cvat-cli/**/*.py | |
tests/python/**/*.py | |
cvat/apps/quality_control/**/*.py | |
dir_names: true | |
- name: Run checks | |
env: | |
PR_FILES_AM: ${{ steps.files.outputs.added_modified }} | |
PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} | |
run: | | |
# If different modules use different Black configs, | |
# we need to run Black for each python component group separately. | |
# Otherwise, they all will use the same config. | |
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) | |
mkdir -p black_report | |
echo "Black version: "$(black --version) | |
echo "The dirs will be checked: $UPDATED_DIRS" | |
EXIT_CODE=0 | |
for DIR in $UPDATED_DIRS; do | |
black --check --diff $DIR >> ./black_report/black_checks.txt || EXIT_CODE=$(($? | $EXIT_CODE)) || true | |
done | |
deactivate | |
exit $EXIT_CODE | |
else | |
echo "No files with the \"py\" extension found" | |
fi | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3.1.1 | |
with: | |
name: black_report | |
path: black_report |