openmv/.github/workflows/python-linter.yml
iabdalkader b552388d49 misc/github: Update workflows.
* Update workflow runner image.
* Install Python for main build.
* Install Vela compiler.
2024-07-23 10:40:39 +03:00

47 lines
1.4 KiB
YAML

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: '🔎 Python Linter'
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- 'master'
paths:
- 'scripts/examples/**.py'
- 'scripts/libraries/**.py'
jobs:
formatting-check:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- name: '⏳ Checkout repository'
uses: actions/checkout@v4
- name: '🐍 Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
- name: '🛠 Install dependencies'
run: |
pip install -r .github/workflows/requirements.txt
flake8 --version
pytest --version
- name: '😾 Lint with flake8'
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics scripts/libraries/ scripts/examples/
flake8 --count --max-complexity=15 --max-line-length=120 --ignore=F821,E722,E741,C901,E713,W605,E203,W503,F841,F403,F405 --statistics scripts/libraries/ scripts/examples/