Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions fix #385

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
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[@]/#/}
Loading