Add flake8 linter and isort workflow to aucmedi #148
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
# This workflow will install Python dependencies and run tests for computing code coverage | |
# The results will be uploaded to codecov | |
# The workflow further executes commitlint, isort, and flake8 linters to ensure a common code style | |
name: Code Quality | |
on: | |
push: | |
branches: [ master, development ] | |
pull_request: | |
branches: [ master, development ] | |
jobs: | |
coverage: | |
name: Coverage (codecov) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest | |
python -m pip install pytest-cov | |
- name: Install package | |
run: | | |
python -m pip install . | |
- name: Generate coverage report | |
run: | | |
pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
verbose: true | |
commitlint: | |
name: Commit Convention | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v4 | |
with: | |
configFile: .github/commitlint.config.js | |
isort-lint: | |
runs-on: ubuntu-latest | |
name: Import Order | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install isort | |
- name: isort Lint | |
run: | | |
python -m isort --settings-path .github --check-only aucmedi | |
flake8-lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 | |
- name: Install package | |
run: | | |
python -m pip install . | |
- name: Run flake8 linter | |
run: | | |
python -m flake8 --config .github/flake8.cfg aucmedi |