Add initial version of python bindings #1208
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
name: test_precommit | |
permissions: read-all | |
on: | |
pull_request: | |
merge_group: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
Python-Functional-Tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: CHECKOUT REPOSITORY | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: pip | |
- name: Create and start a virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install model_api/python/[tests,ovms] --extra-index-url https://download.pytorch.org/whl/cpu | |
- name: Prepare test data | |
run: | | |
source venv/bin/activate | |
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json | |
- name: Run test | |
run: | | |
source venv/bin/activate | |
pytest --data=./data tests/python/funtional | |
CPP-Code-Quality: | |
name: CPP-Code-Quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: cppcheck | |
uses: chmorgan/cppcheck-action@main | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN}} | |
# missingInclude: cppcheck can't find stl, openvino, opencv | |
other_options: --suppress=missingInclude -Imodel_api/cpp/models/include -Imodel_api/cpp/utils/include -Imodel_api/cpp/pipelines/include --check-config | |
CPP-Precommit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: pip | |
- name: Create and start a virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install model_api/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu | |
sudo bash model_api/cpp/install_dependencies.sh | |
- name: Prepare test data | |
run: | | |
source venv/bin/activate | |
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json | |
- name: Build | |
run: | | |
source venv/bin/activate | |
mkdir build && cd build | |
cmake ../tests/cpp/precommit/ -DCMAKE_CXX_FLAGS=-Werror | |
cmake --build . -j $((`nproc`*2+2)) | |
- name: Run test | |
run: | | |
build/test_sanity -d data -p tests/cpp/precommit/public_scope.json && build/test_model_config -d data | |
CPP-Windows-Precommit: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: pip | |
- name: Create and start a virtual environment | |
shell: bash | |
run: | | |
python -m venv venv | |
source venv/Scripts/activate | |
- name: Install dependencies | |
shell: bash | |
run: | | |
source venv/Scripts/activate | |
python -m pip install --upgrade pip | |
pip install model_api/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu | |
curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/windows/w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64.zip --output w_openvino_toolkit_windows.zip | |
unzip w_openvino_toolkit_windows.zip | |
rm w_openvino_toolkit_windows.zip | |
curl -L https://github.com/opencv/opencv/releases/download/4.10.0/opencv-4.10.0-windows.exe --output opencv-4.10.0-windows.exe | |
./opencv-4.10.0-windows.exe -oopencv -y | |
rm opencv-4.10.0-windows.exe | |
- name: Prepare test data | |
shell: bash | |
run: | | |
source venv/Scripts/activate | |
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json | |
- name: Build | |
shell: bash | |
run: | | |
mkdir build && cd build | |
MSYS_NO_PATHCONV=1 cmake ../examples/cpp/ -DOpenVINO_DIR=$GITHUB_WORKSPACE/w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64/runtime/cmake -DOpenCV_DIR=$GITHUB_WORKSPACE/opencv/opencv/build -DCMAKE_CXX_FLAGS=/WX -DENABLE_PY_BINDINGS=OFF | |
cmake --build . --config Release -j $((`nproc`*2+2)) | |
- name: Run sync sample | |
shell: cmd | |
# .\w_openvino_toolkit_windows_2023.0.0.10926.b4452d56304_x86_64\setupvars.bat exits with 0 code without moving to a next command. Set PATH manually | |
run: | | |
set PATH=opencv\opencv\build\x64\vc16\bin;w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64\runtime\bin\intel64\Release;w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64\runtime\3rdparty\tbb\bin;%PATH% | |
.\build\Release\synchronous_api.exe .\data\public\ssd_mobilenet_v1_fpn_coco\FP16\ssd_mobilenet_v1_fpn_coco.xml .\data\BloodImage_00007.jpg | |
serving_api: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
python-version: [3.9, "3.10", "3.11"] | |
exclude: | |
- os: ubuntu-24.04 | |
python-version: "3.9" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up docker for macOS | |
if: startsWith(matrix.os, 'macos-1') | |
run: | | |
brew install colima docker | |
colima start | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: serving_api | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install model_api/python/[ovms,tests] | |
python -c "from model_api.models import DetectionModel; DetectionModel.create_model('ssd_mobilenet_v1_fpn_coco').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 | |
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json | |
python examples/python/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects |