Feature/update #42
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: 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="((?:logs|datasets|output|PixelFormer|frames_detected|model_weights|venv|yolov[0-9]))" --check --verbose --diff --color >> black_errors.txt || exit 1 | |
- name: Run pylint | |
run: | | |
pylint --exit-zero --output-format=text --disable=E0401,R0914,R1702,R1735,R0912,R0915,R0913,R0903 --ignore-patterns="((?:logs|datasets|output|PixelFormer|frames_detected|model_weights|venv|yolov[0-9]))" . >> pylint_errors.txt || exit 1 | |
- name: Run pydocstyle | |
run: | | |
pydocstyle --ignore-self-only-init --ignore=D100,D104,D213,D203,D404 --match-dir='^(?:(?!logs|datasets|output|PixelFormer|frames_detected|model_weights|custom_pixelformer|notebooks|venv|yolov[0-9]).)*$' . >> pydocstyle_errors.txt || exit 1 | |
- name: Run mypy | |
run: | | |
cd .. | |
mypy --exclude="((?:logs|datasets|output|PixelFormer|frames_detected|model_weights|venv|yolov[0-9]))" --ignore-missing-imports -p speed-estimation-traffic-monitoring >> 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/speed-estimation-traffic-monitoring/mypy_errors.txt | |
- name: Cleanup virtual environment | |
run: | | |
deactivate || true | |
rm -rf venv |