Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] [GHA] Introduce additional Python (3.9-3.12) API tests on Ubuntu 22 #26897

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/actions/install_ov_wheels/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: 'Find and install OpenVINO Python wheels'
description: 'Finds the OpenVINO Python wheels (core, dev and tokenizers) suitable for "python3" executable and installs them'
inputs:
install-dir-path:
description: 'Path to the INSTALL directory in which wheels are located'
required: true
install-core-wheel:
description: 'Whether to install the OpenVINO Core wheel (openvino-*.whl)'
required: true
install-dev-wheel:
description: 'Whether to install the OpenVINO Dev wheel (openvino_dev*.whl)'
required: true
extras-to-install:
description: 'Extras to install with the OpenVINO Dev wheel (openvino_dev.whl[caffe,kaldi,onnx,tensorflow2,pytorch])'
required: false
default: ''
install-tokenizers-wheel:
description: 'Whether to install the OpenVINO Dev wheel (openvino_tokenizes*.whl)'
required: true
runs:
using: 'composite'
steps:
- name: Install OpenVINO Python wheels (Windows)
shell: pwsh
if: runner.os == 'Windows'
run: |
if ( "${{ inputs.install-core-wheel }}" -eq "true" )
{
Push-Location "${{ inputs.install-dir-path }}\tools"
$py_version = python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')"
$ov_wheel_name = Get-ChildItem -Name "openvino-*cp$py_version*.whl" -Recurse
python3 -m pip install $ov_wheel_name
Pop-Location
}

if ( "${{ inputs.install-tokenizers-wheel }}" -eq "true" )
{
$ovCoreWheelPath=Get-ChildItem -Path ${{ inputs.install-dir-path }} -Filter openvino_tokenizers-*.whl | % { $_.FullName }
python3 -m pip install "$ovCoreWheelPath"
}

if ( "${{ inputs.install-core-wheel }}" -eq "true" )
{
$ovDevWheelPath=Get-ChildItem -Path "${{ inputs.install-dir-path }}\tools" -Filter openvino_dev*.whl | % { $_.FullName }
if ( "${{ inputs.extras-to-install }}" )
{
python3 -m pip install "$ovDevWheelPath[${{ inputs.extras-to-install }}]"
}
else
{
python3 -m pip install "$ovDevWheelPath"
}
}

- name: Install OpenVINO Python wheels (Linux and macOS)
shell: bash
if: runner.os != 'Windows'
run: |
if [[ "${{ inputs.install-core-wheel }}" == "true" ]]; then
pushd ${{ inputs.install-dir-path }}/tools
py_version=$(python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")
ov_wheel_name=$(find . -name "openvino-*cp$py_version*.whl")
python3 -m pip install $ov_wheel_name
popd
fi

if [[ "${{ inputs.install-tokenizers-wheel }}" == "true" ]]; then
python3 -m pip install ${{ inputs.install-dir-path }}/openvino_tokenizers-*.whl
fi

if [[ "${{ inputs.install-dev-wheel }}" == "true" ]]; then
pushd ${{ inputs.install-dir-path }}/tools
ov_dev_wheel_name=$(find . -name 'openvino_dev*.whl')
if [[ "${{ inputs.extras-to-install }}" ]]; then
python3 -m pip install $ov_dev_wheel_name[${{ inputs.extras-to-install }}]
else
python3 -m pip install $ov_dev_wheel_name
fi
popd
fi
2 changes: 1 addition & 1 deletion .github/dockerfiles/docker_tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pr-26586
pr-26897
21 changes: 20 additions & 1 deletion .github/dockerfiles/ov_build/ubuntu_22_04_x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ RUN apt-get update && \
tzdata \
libtbb2 \
# Pythons \
python3.9-dev \
python3.9-venv \
python3.9-distutils \
python3.10-dev \
python3.10-venv \
python3.10-distutils \
python3.11-dev \
python3.11-venv \
python3.11-distutils \
python3.12-dev \
python3.12-venv \
python3.12-distutils \
# For Java API
default-jdk \
&& \
Expand All @@ -52,10 +61,20 @@ ENV PATH="$SCCACHE_HOME:$PATH"
# Setup pip
ENV PIP_VERSION="24.0"
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \
python3.9 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \
python3.10 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \
python3.11 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \
python3.12 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \
rm -f get-pip.py

# Setup wheel and setuptools packages
ENV SETUPTOOLS_VERSION=75.1.0
ENV WHEEL_VERSION=0.44.0
RUN python3.9 -m pip install wheel==${WHEEL_VERSION} setuptools==${SETUPTOOLS_VERSION} && \
python3.10 -m pip install wheel==${WHEEL_VERSION} setuptools==${SETUPTOOLS_VERSION} && \
python3.11 -m pip install wheel==${WHEEL_VERSION} setuptools==${SETUPTOOLS_VERSION} && \
python3.12 -m pip install wheel==${WHEEL_VERSION} setuptools==${SETUPTOOLS_VERSION}

# Use Python 3.11 as default
# Using venv here 'cause other methods to switch the default Python on Ubuntu break both system and wheels build
RUN python3.11 -m venv venv
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/job_build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ on:
type: boolean
required: false
default: false
build-additional-python-wheels:
description: 'Whether to build additional, i.e., non-system Python wheels. Should have Python 3.9-3.12 installed under /usr/bin'
type: boolean
required: false
default: false

permissions: read-all

Expand Down Expand Up @@ -180,6 +185,18 @@ jobs:
cmake -DCMAKE_INSTALL_PREFIX=${DEVELOPER_PACKAGE_DIR} -DCOMPONENT=developer_package -P ${BUILD_DIR}/cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCOMPONENT=python_wheels -P ${BUILD_DIR}/cmake_install.cmake

- name: Build additional Python wheels
if: ${{ inputs.build-additional-python-wheels }}
run: |
for py_version in "3.9" "3.10" "3.11" "3.12"
do
export PY_BUILD_DIR=/__w/openvino/openvino/py$py_version
mkdir -p ${PY_BUILD_DIR}
cmake -DPython3_EXECUTABLE=/usr/bin/python$py_version -DOpenVINODeveloperPackage_DIR=${BUILD_DIR} -S ${OPENVINO_REPO}/src/bindings/python -B ${PY_BUILD_DIR}
cmake --build ${PY_BUILD_DIR} --parallel
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCOMPONENT=python_wheels -P ${PY_BUILD_DIR}/cmake_install.cmake
done

- name: Pack Artifacts
run: |

Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/job_jax_models_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ jobs:
tar -xzf openvino_tests.tar.gz -C ${INSTALL_DIR}
popd

- name: Fetch setup_python action
- name: Fetch setup_python and install wheels actions
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
sparse-checkout: |
.github/actions/setup_python/action.yml
.github/actions/install_ov_wheels/action.yml
sparse-checkout-cone-mode: false
path: 'openvino'

Expand All @@ -87,11 +88,12 @@ jobs:
self-hosted-runner: ${{ contains(inputs.runner, 'aks') }}

- name: Install OpenVINO Python wheels
run: |
# To enable pytest parallel features
python3 -m pip install pytest-xdist[psutil]
python3 -m pip install ${INSTALL_DIR}/tools/openvino-*
python3 -m pip install ${INSTALL_DIR}/openvino_tokenizers-*
uses: ./openvino/.github/actions/install_ov_wheels
with:
install-dir-path: ${{ env.INSTALL_DIR }}
install-core-wheel: true
install-dev-wheel: false
install-tokenizers-wheel: true

- name: Install JAX tests requirements for precommit
run: |
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/job_onnx_models_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,22 @@ jobs:
# - name: Update Models
# run: bash ${OPENVINO_REPO}/src/frontends/onnx/tests/tests_python/model_zoo_preprocess.sh -d ${MODELS_SHARE_PATH} -o -s "${{ env.ONNX_MODEL_ZOO_SHA }}"

- name: Install OpenVINO Python wheels
run: |
# Install the core OV wheel
python3 -m pip install ${INSTALL_DIR}/tools/openvino-*.whl

extras_to_install="onnx"
- name: Fetch install wheels action
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
sparse-checkout: |
.github/actions/install_ov_wheels/action.yml
sparse-checkout-cone-mode: false
path: 'openvino'

# Find and install OV dev wheel
pushd ${INSTALL_DIR}/tools
ov_dev_wheel_name=$(find . -name 'openvino_dev*.whl')
python3 -m pip install $ov_dev_wheel_name[$extras_to_install]
popd
- name: Install OpenVINO Python wheels
uses: ./openvino/.github/actions/install_ov_wheels
with:
install-dir-path: ${{ env.INSTALL_DIR }}
install-core-wheel: true
install-dev-wheel: true
extras-to-install: 'onnx'
install-tokenizers-wheel: false

- name: Install Python tests dependencies
run: |
Expand Down
132 changes: 132 additions & 0 deletions .github/workflows/job_python_api_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: OpenVINO Python API tests

on:
workflow_call:
inputs:
runner:
description: 'Machine on which the tests would run'
type: string
required: true
container:
description: 'JSON to be converted to the value of the "container" configuration for the job'
type: string
required: false
default: '{"image": null}'
python-version:
description: 'Python version to setup. E.g., "3.11"'
type: string
required: true

permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux

jobs:
Python_Unit_Tests:
name: OpenVINO Python API tests
timeout-minutes: 30
runs-on: ${{ inputs.runner }}
container: ${{ fromJSON(inputs.container) }}
defaults:
run:
shell: bash
env:
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
OPENVINO_REPO: ${{ github.workspace }}/openvino
INSTALL_DIR: ${{ github.workspace }}/install
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
steps:

- name: Download OpenVINO package
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: openvino_package
path: ${{ env.INSTALL_DIR }}

- name: Download OpenVINO tests package
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: openvino_tests
path: ${{ env.INSTALL_TEST_DIR }}

# Needed as ${{ github.workspace }} is not working correctly when using Docker
- name: Setup Variables
run: |
echo "OPENVINO_REPO=$GITHUB_WORKSPACE/openvino" >> "$GITHUB_ENV"
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV"

- name: Extract OpenVINO packages
run: |
pushd $INSTALL_DIR
tar -xzf openvino_package.tar.gz -C $INSTALL_DIR
popd
pushd $INSTALL_TEST_DIR
tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR
popd

- name: Fetch setup_python and install wheels actions
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
sparse-checkout: |
.github/actions/setup_python/action.yml
.github/actions/install_ov_wheels/action.yml
sparse-checkout-cone-mode: false
path: 'action_root'

- name: Setup Python ${{ inputs.python-version }}
uses: ./action_root/.github/actions/setup_python
with:
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}

#
# Tests
#
- name: Install OpenVINO Python wheels
uses: ./action_root/.github/actions/install_ov_wheels
with:
install-dir-path: ${{ env.INSTALL_DIR }}
install-core-wheel: true
install-dev-wheel: true
extras-to-install: 'caffe,kaldi,onnx,tensorflow2,pytorch'
install-tokenizers-wheel: false

- name: Install Python API tests dependencies
run: python3 -m pip install -r ${INSTALL_TEST_DIR}/bindings/python/requirements_test.txt

#
# Tests
#

- name: Python API Tests
run: |
# for 'template' extension
export LD_LIBRARY_PATH=${INSTALL_TEST_DIR}:$LD_LIBRARY_PATH
python3 -m pytest -sv ${INSTALL_TEST_DIR}/pyopenvino \
--junitxml=${INSTALL_TEST_DIR}/TEST-Pyngraph.xml \
--ignore=${INSTALL_TEST_DIR}/pyopenvino/tests/test_utils/test_utils.py

- name: Python API Tests -- numpy>=2.0.0
run: |
python3 -m pip uninstall -y numpy
python3 -m pip install "numpy>=2.0.0,<2.1.0"
python3 -m pip install -r ${INSTALL_TEST_DIR}/bindings/python/requirements_test.txt
# for 'template' extension
export LD_LIBRARY_PATH=${INSTALL_TEST_DIR}:$LD_LIBRARY_PATH
python3 -m pytest -sv ${INSTALL_TEST_DIR}/pyopenvino \
--junitxml=${INSTALL_TEST_DIR}/TEST-Pyngraph_new_numpy.xml \
--ignore=${INSTALL_TEST_DIR}/pyopenvino/tests/test_utils/test_utils.py

- name: Upload Test Results
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: ${{ !cancelled() }}
with:
name: test-results-python-api-${{ inputs.python-version }}
path: |
${{ env.INSTALL_TEST_DIR }}/TEST*.html
${{ env.INSTALL_TEST_DIR }}/TEST*.xml
if-no-files-found: 'warn'
Loading
Loading