From 78500a5cffef197342bdf58dd656478af4887094 Mon Sep 17 00:00:00 2001 From: "Tybulewicz, Tomasz" Date: Mon, 6 Jul 2026 13:21:24 +0200 Subject: [PATCH 1/5] test: display CPU info on failed accuracy test --- model_api/tests/functional/test_inference.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/model_api/tests/functional/test_inference.py b/model_api/tests/functional/test_inference.py index 6e1c4204..d988c22a 100644 --- a/model_api/tests/functional/test_inference.py +++ b/model_api/tests/functional/test_inference.py @@ -5,6 +5,8 @@ import ast import json import operator +import platform +import subprocess from pathlib import Path import cv2 @@ -85,6 +87,8 @@ def create_models( configuration=None, dump: bool = False, ): + print(get_processor_name()) + if model_path.endswith(".onnx") and force_onnx_adapter: wrapper_type = model_type.get_model_class( load_parameters_from_onnx(onnx.load(model_path))["model_info"]["model_type"], @@ -592,3 +596,13 @@ def store_outputs(name, image, device, result, results_dir: str) -> None: visualizer.save(image, result, path) except (TypeError, ValueError) as e: print(f"Cannot save the output visualization for {name}. Error: {e}") + + +def get_processor_name(): + if platform.system() == "Windows": + return platform.processor() + if platform.system() == "Linux": + command = "cat /proc/cpuinfo" + return subprocess.check_output(command, shell=True).decode().strip() # noqa: S602 + + return "" From fd104313fb4a95de1622618bc7684683199fb1c0 Mon Sep 17 00:00:00 2001 From: "Tybulewicz, Tomasz" Date: Mon, 6 Jul 2026 13:51:03 +0200 Subject: [PATCH 2/5] Early exit on first failure --- .github/workflows/pre_commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml index dce91949..fe9c58bc 100644 --- a/.github/workflows/pre_commit.yml +++ b/.github/workflows/pre_commit.yml @@ -120,7 +120,7 @@ jobs: - name: Run test run: | - uv --directory model_api run pytest --data=./data tests/functional + uv --directory model_api run pytest --data=./data tests/functional -sx serving_api-tests: strategy: From 5489731bc3ae26d34b79ad9b7d471bec52ed6339 Mon Sep 17 00:00:00 2001 From: "Tybulewicz, Tomasz" Date: Mon, 6 Jul 2026 14:17:39 +0200 Subject: [PATCH 3/5] whitespace --- model_api/tests/functional/test_inference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model_api/tests/functional/test_inference.py b/model_api/tests/functional/test_inference.py index d988c22a..b22bd312 100644 --- a/model_api/tests/functional/test_inference.py +++ b/model_api/tests/functional/test_inference.py @@ -87,7 +87,7 @@ def create_models( configuration=None, dump: bool = False, ): - print(get_processor_name()) + print(f"Running tests on platform\n\n{get_processor_name()}\n\n") if model_path.endswith(".onnx") and force_onnx_adapter: wrapper_type = model_type.get_model_class( From 01200620adb5c748b7587d32ce2e4fa15ba3549f Mon Sep 17 00:00:00 2001 From: "Tybulewicz, Tomasz" Date: Mon, 6 Jul 2026 14:32:21 +0200 Subject: [PATCH 4/5] Reduce number of checks --- .github/workflows/pre_commit.yml | 109 ++----------------------------- 1 file changed, 5 insertions(+), 104 deletions(-) diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml index fe9c58bc..b39fc82c 100644 --- a/.github/workflows/pre_commit.yml +++ b/.github/workflows/pre_commit.yml @@ -14,49 +14,6 @@ concurrency: cancel-in-progress: true jobs: - code_quality_checks: - runs-on: ubuntu-latest - steps: - - name: Harden the runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 - with: - disable-sudo: true - disable-telemetry: true - egress-policy: block - allowed-endpoints: > - files.pythonhosted.org:443 - github.com:443 - nodejs.org:443 - pypi.org:443 - raw.githubusercontent.com:443 - registry.npmjs.org:443 - releases.astral.sh:443 - - - &checkout - name: Checkout code - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - with: - persist-credentials: false - - - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version-file: ".python-version" - - - name: Install uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - enable-cache: false - version: "0.11.13" - - - name: Install dependencies - run: | - uv --directory model_api sync --locked --all-extras --group docs - uv --directory model_converter sync --locked - - - name: Run pre-commit checks - run: uvx pre-commit run --all-files - unit-functional-tests: strategy: fail-fast: false @@ -95,7 +52,11 @@ jobs: storage.geti.intel.com:443 telemetry-incoming.r53-2.services.mozilla.com:443 - - *checkout + - &checkout + name: Checkout code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false - &matrix-setup-uv name: Install uv @@ -122,70 +83,10 @@ jobs: run: | uv --directory model_api run pytest --data=./data tests/functional -sx - serving_api-tests: - strategy: - fail-fast: false - matrix: - os: - - "ubuntu-latest" - python-version: - - "3.11" - - "3.12" - - "3.13" - - "3.14" - runs-on: ${{ matrix.os }} - steps: - - name: Harden the runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 - with: - disable-sudo: true - disable-telemetry: true - egress-policy: block - allowed-endpoints: > - auth.docker.io:443 - download.pytorch.org:443 - dseasb33srnrn.cloudfront.net:443 - files.pythonhosted.org:443 - github.com:443 - production.cloudflare.docker.com:443 - production.cloudfront.docker.com:443 - pypi.org:443 - raw.githubusercontent.com:443 - registry-1.docker.io:443 - releases.astral.sh:443 - storage.geti.intel.com:443 - index.docker.io:443 - - name: Set up docker for macOS - if: startsWith(matrix.os, 'macos-1') - run: | - brew install colima docker - colima start - - - *checkout - - - *matrix-setup-uv - - - name: Install dependencies - run: uv --directory model_api sync --locked --group tests --extra ovms --extra-index-url https://download.pytorch.org/whl/cpu - - - name: Prepare test data - run: | - uv --directory model_api run python tests/functional/download_models.py -d data -j tests/functional/serving_scope.json -l - - - name: serving_api - run: | - uv --directory model_api run python -c "from model_api.models import Model; Model.create_model('./data/otx_models/ssd-card-detection.xml').save('ovms_models/ssd-card-detection/1/ssd-card-detection.xml')" - docker run -d --rm -v $GITHUB_WORKSPACE/model_api/ovms_models/:/models -p 8000:8000 openvino/model_server:latest --model_path /models/ssd-card-detection/ --model_name ssd-card-detection --rest_port 8000 --log_level DEBUG --target_device CPU - echo "Waiting for OVMS to be ready..." - timeout 120 bash -c 'until curl -sf http://localhost:8000/v2/health/ready; do sleep 3; done' - uv --directory model_api run python examples/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects - pre-commit-result: runs-on: ubuntu-latest needs: - - code_quality_checks - unit-functional-tests - - serving_api-tests if: always() steps: - name: All tests ok From 9f0402fdf7b56e87b64b499df8166ceb0877e506 Mon Sep 17 00:00:00 2001 From: "Tybulewicz, Tomasz" Date: Mon, 6 Jul 2026 14:35:16 +0200 Subject: [PATCH 5/5] Even less tests --- .github/workflows/pre_commit.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml index b39fc82c..428034c4 100644 --- a/.github/workflows/pre_commit.yml +++ b/.github/workflows/pre_commit.yml @@ -31,27 +31,6 @@ jobs: python-version: "3.14" # started to fail with "Windows fatal exception: access violation" runs-on: ${{ matrix.os }} steps: - - name: Harden the runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 - with: - disable-sudo: true - disable-telemetry: true - egress-policy: block - allowed-endpoints: > - dc.services.visualstudio.com:443 - download.pytorch.org:443 - files.pythonhosted.org:443 - github.com:443 - incoming.telemetry.mozilla.org:443 - ocsp.digicert.com:443 - ocsp.sectigo.com:443 - pypi.org:443 - raw.githubusercontent.com:443 - releases.astral.sh:443 - settings-win.data.microsoft.com:443 - storage.geti.intel.com:443 - telemetry-incoming.r53-2.services.mozilla.com:443 - - &checkout name: Checkout code uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -69,12 +48,6 @@ jobs: - name: Install dependencies run: uv --directory model_api sync --locked --group tests --extra-index-url https://download.pytorch.org/whl/cpu - - name: Run model_api unit tests - run: uv --directory model_api run pytest tests/unit --cov - - - name: Run model_converter unit tests - run: uv --directory model_converter run --group tests pytest tests/unit --cov - - name: Prepare test data run: | uv --directory model_api run python tests/functional/download_models.py -d data -j tests/functional/public_scope.json -l