Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest
# runs-on: self-hosted
strategy:
Expand All @@ -19,22 +18,40 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install radon
pip install flake8
pip install flake8-polyfill
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Get all Python changed and modified files
id: changed-python-files
uses: tj-actions/changed-files@v42
with:
since_last_remote_commit: true
files: |
**.py

- name: Code complexity
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_PYTHON_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
# Runs Radon quality check
radon cc python --total-average --show-complexity
radon cc --total-average --show-complexity ${ALL_CHANGED_PYTHON_FILES[@]/#/}

- name: Code quality with flake8
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_PYTHON_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
# Runs code quality check
flake8 python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 --count --max-complexity=10 --max-line-length=127 --statistics ${ALL_CHANGED_PYTHON_FILES[@]/#/}