diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml index a2154ea8..9eef0ad6 100644 --- a/.github/workflows/pre_commit.yml +++ b/.github/workflows/pre_commit.yml @@ -14,45 +14,31 @@ on: workflow_dispatch: # run on request (no need for PR) jobs: - Code-Quality-Checks: - runs-on: ubuntu-24.04 + serving_api: + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, ubuntu-24.04] + python-version: ["3.10", "3.11", "3.13"] + runs-on: ${{ matrix.os }} steps: - - name: CHECKOUT REPOSITORY - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: Set up Python - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 - with: - python-version-file: ".python-version" - - name: Set up Node.js - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 - with: - node-version: 22 - - name: Install uv - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 - - name: Install dependencies - run: | - uv sync --locked --all-extras - - name: Run pre-commit checks + - name: Set up docker for macOS + if: startsWith(matrix.os, 'macos-1') run: | - uv run pre-commit run --all-files - Unit-Tests: - runs-on: ubuntu-24.04 - steps: - - name: CHECKOUT REPOSITORY - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + brew install colima docker + colima start + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - - name: Set up Python - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: - python-version-file: ".python-version" + python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 - - name: Install dependencies + - name: serving_api run: | uv sync --locked --extra tests --extra ovms - - name: Run python unit tests - run: | - uv run pytest tests/unit --cov + uv run python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json + uv run python -c "from model_api.models import DetectionModel; DetectionModel.create_model('./data/otx_models/detection_model_with_xai_head.xml').save('ovms_models/ssd_mobilenet_v1_fpn_coco/1/ssd_mobilenet_v1_fpn_coco.xml')" + docker run -d --rm -v $GITHUB_WORKSPACE/ovms_models/:/models -p 8000:8000 openvino/model_server:latest --model_path /models/ssd_mobilenet_v1_fpn_coco/ --model_name ssd_mobilenet_v1_fpn_coco --rest_port 8000 --log_level DEBUG --target_device CPU + uv run python examples/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects diff --git a/.github/workflows/test_precommit.yml b/.github/workflows/test_precommit.yml index 5fd492aa..1eb9fed3 100644 --- a/.github/workflows/test_precommit.yml +++ b/.github/workflows/test_precommit.yml @@ -9,28 +9,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: - Python-Functional-Tests: - runs-on: ubuntu-24.04 - steps: - - name: CHECKOUT REPOSITORY - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: Set up Python - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 - with: - python-version-file: ".python-version" - - name: Install uv - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 - - name: Install dependencies - run: | - uv sync --locked --extra tests --extra ovms --extra-index-url https://download.pytorch.org/whl/cpu - - name: Prepare test data - run: | - uv run python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json - - name: Run test - run: | - uv run pytest --data=./data tests/functional serving_api: strategy: fail-fast: false @@ -59,52 +37,3 @@ jobs: uv run python -c "from model_api.models import DetectionModel; DetectionModel.create_model('./data/otx_models/detection_model_with_xai_head.xml').save('ovms_models/ssd_mobilenet_v1_fpn_coco/1/ssd_mobilenet_v1_fpn_coco.xml')" docker run -d --rm -v $GITHUB_WORKSPACE/ovms_models/:/models -p 8000:8000 openvino/model_server:latest --model_path /models/ssd_mobilenet_v1_fpn_coco/ --model_name ssd_mobilenet_v1_fpn_coco --rest_port 8000 --log_level DEBUG --target_device CPU uv run python examples/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects - Zizmor-Scan-PR: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout code - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: Run Zizmor scan - uses: open-edge-platform/geti-ci/actions/zizmor@c2bb2697178bb2e50014420aef2351a45749b925 - with: - scan-scope: "changed" - severity-level: "LOW" - confidence-level: "LOW" - fail-on-findings: true - Bandit-Scan-PR: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout code - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: Run Bandit scan - uses: open-edge-platform/geti-ci/actions/bandit@c2bb2697178bb2e50014420aef2351a45749b925 - with: - scan-scope: "changed" - severity-level: "LOW" - confidence-level: "LOW" - config_file: "./pyproject.toml" - fail-on-findings: true - - Semgrep-Scan-PR: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout code - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: Run Bandit scan - uses: open-edge-platform/geti-ci/actions/semgrep@c2bb2697178bb2e50014420aef2351a45749b925 - with: - scan-scope: "changed" - severity: "LOW" - fail-on-findings: true diff --git a/README.md b/README.md index f64f30f1..6ce426f5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # OpenVINO Model API [![PyPI](https://img.shields.io/pypi/v/otx)](https://pypi.org/project/openvino-model-api)