You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
name: Linter
|
|
on: pull_request
|
|
jobs:
|
|
isort:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- id: files
|
|
uses: jitterbit/get-changed-files@v1
|
|
continue-on-error: true
|
|
|
|
- name: Run checks
|
|
env:
|
|
PR_FILES_AM: ${{ steps.files.outputs.added_modified }}
|
|
PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }}
|
|
run: |
|
|
PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED"
|
|
for FILE in $PR_FILES; do
|
|
EXTENSION="${FILE##*.}"
|
|
DIRECTORY="${FILE%%/*}"
|
|
if [[ "$EXTENSION" == "py" && "$DIRECTORY" == "cvat-cli" ]]; then
|
|
CHANGED_FILES+=" $FILE"
|
|
fi
|
|
done
|
|
|
|
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 "isort.*" ./cvat-cli/requirements/development.txt)
|
|
mkdir -p isort_report
|
|
|
|
echo "isort version: "$(isort --version)
|
|
echo "The files will be checked: "$(echo $CHANGED_FILES)
|
|
isort --check --sp ./cvat-cli/pyproject.toml $CHANGED_FILES > ./isort_report/isort_checks.txt || EXIT_CODE=$(echo $?) || true
|
|
deactivate
|
|
exit $EXIT_CODE
|
|
else
|
|
echo "No files with the \"py\" extension found"
|
|
fi
|
|
|
|
- name: Upload artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: isort_report
|
|
path: isort_report
|