-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (65 loc) · 2.13 KB
/
code-quality.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Code Quality
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
env:
VIRTUAL_ENV: venv
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
.cache/pip
venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install virtualenv
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Create virtualenv
run: |
virtualenv $VIRTUAL_ENV
source $VIRTUAL_ENV/bin/activate
- name: Install linters and tools
run: |
pip install pylint mypy black safety pydocstyle
- name: Debugging
run: |
pwd
- name: Run black
run: |
black . --exclude="((?:data|experiments|model_results|venv|frontend))" --check --verbose --diff --color >> black_errors.txt || exit 1
- name: Run pylint
run: |
pylint --exit-zero --output-format=text --recursive=true --disable=C0114,C0115,C0116,F0010,E0401,R0914,R1702,R1735,R0912,R0915,R0913,R0903,C0413 --ignore-patterns="((?:data|experiments|model_results|venv|frontend))" . >> pylint_errors.txt || exit 1
- name: Run mypy
run: |
mypy --exclude="((?:data|experiments|model_results|venv|frontend))" --ignore-missing-imports --install-types --install-types --non-interactive . >> mypy_errors.txt || exit 1
- name: Upload error artifacts
uses: actions/upload-artifact@v3
with:
name: code-quality-errors
path: |
black_errors.txt
pylint_errors.txt
pydocstyle_errors.txt
/home/runner/work/hpi-porsche-challenge/mypy_errors.txt
- name: Cleanup virtual environment
run: |
deactivate || true
rm -rf venv