forked from cvat-ai/cvat
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (46 loc) · 1.78 KB
/
pylint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Linter
on: pull_request
jobs:
PyLint:
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##*.}"
if [[ $EXTENSION == 'py' ]]; 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 pylint-json2html
pip install $(egrep "pylint.*" ./cvat/requirements/development.txt)
pip install $(egrep "Django.*" ./cvat/requirements/base.txt)
mkdir -p pylint_report
echo "Pylint version: "$(pylint --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
pylint $CHANGED_FILES --output-format=json > ./pylint_report/pylint_checks.json || EXIT_CODE=$(echo $?) || true
pylint-json2html -o ./pylint_report/pylint_checks.html ./pylint_report/pylint_checks.json
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: pylint_report
path: pylint_report