Skip to content

Changes from upstream/master #1219

Changes from upstream/master

Changes from upstream/master #1219

Workflow file for this run

name: Python API Checks
on:
workflow_dispatch:
push:
paths:
- 'src/bindings/python/**'
- 'samples/python/**'
- '.github/workflows/py_checks.yml'
branches:
- 'master'
- 'releases/**'
pull_request:
paths:
- 'src/bindings/python/**'
- 'samples/python/**'
- '.github/workflows/py_checks.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
linters:
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.9'
- name: Install dependencies
run: python -m pip install -r src/bindings/python/requirements_test.txt
# samples code-style
- name: Run flake8 on samples
run: python -m flake8 ./ --config=setup.cfg
working-directory: samples/python
- name: Create code style diff for samples
if: failure()
run: |
python -m black -l 160 -S ./
git diff > samples_diff.diff
working-directory: samples/python
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: failure()
with:
name: samples_diff
path: samples_diff.diff
# Python API Flake code-style
- name: Run flake8 on Python API
run: python -m flake8 ./src/openvino --config=setup.cfg
working-directory: src/bindings/python
- name: Create code style diff for Python API
if: failure()
run: |
python -m black -l 160 -S ./
git diff > pyopenvino_diff.diff
working-directory: src/bindings/python/src/openvino
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: failure()
with:
name: pyopenvino_diff
path: pyopenvino_diff.diff
# wheel Flake code-style
- name: Run flake8 on wheel
run: python -m flake8 ./ --config=../setup.cfg
working-directory: src/bindings/python/wheel
- name: Create code style diff for wheel
if: failure()
run: |
python -m black -l 160 -S ./
git diff > wheel_diff.diff
working-directory: src/bindings/python/wheel
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: failure()
with:
name: wheel_diff
path: wheel_diff.diff
# Python API tests Flake code-style
- name: Run flake8 on python tests
# ignore lack of docs in tests
run: python -m flake8 tests/ --config=setup.cfg
working-directory: src/bindings/python
# Python API mypy check
- name: Run mypy on Python API
run: python -m mypy ./src/openvino --config-file ./setup.cfg
working-directory: src/bindings/python
# layer_tests Flake code-style
- name: Run flake8 on python tests in openvino/tests/layer_tests
run: |
modified_files=$(git diff --name-only)
for file in $modified_files; do
if [[ $file == "openvino/tests/layer_tests/"* ]]; then
if [[ -f "$file" ]]; then
python -m flake8 "$file" --config= ./setup.cfg
fi
fi
done