Skip to content

Commit 8ec51b2

Browse files
authored
[CI] [GHA] Introduce additional Python (3.9-3.12) API tests on Windows (openvinotoolkit#27304)
### Tickets: - *152705*
1 parent f11d8a5 commit 8ec51b2

6 files changed

+239
-75
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 'Find and install OpenVINO Python wheels'
2+
description: 'Finds the OpenVINO Python wheels suitable for the "python3" executable and installs them'
3+
inputs:
4+
wheels-dir-path:
5+
description: 'Path to the directory in which wheels are located'
6+
required: true
7+
wheels-to-install:
8+
description: 'List of wheel names to install in the form of "openvino openvino_tokenizers"'
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Install OpenVINO Python wheels (Windows)
13+
shell: pwsh
14+
if: runner.os == 'Windows'
15+
run: |
16+
# Get the Python version
17+
$pyVersion = python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')"
18+
19+
foreach ($wheel in $("${{ inputs.wheels-to-install }}" -split ' ')) {
20+
# Search for the python-specific wheel version and install it if exists
21+
$wheelPath = Get-ChildItem -Path ${{ inputs.wheels-dir-path }} -Filter "$wheel-*cp$pyVersion*.whl" | Select-Object -First 1
22+
if ($wheelPath) {
23+
python3 -m pip install $wheelPath.FullName
24+
} else {
25+
# If the python-specific version does not exist, install by name only
26+
$wheelPathByName = Get-ChildItem -Path ${{ inputs.wheels-dir-path }} -Filter "$wheel-*.whl" | Select-Object -First 1
27+
python3 -m pip install $wheelPathByName.FullName
28+
}
29+
}
30+
31+
- name: Install OpenVINO Python wheels (Linux and macOS)
32+
shell: bash
33+
if: runner.os != 'Windows'
34+
run: |
35+
py_version=$(python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")
36+
for wheel in ${{ inputs.wheels-to-install }}; do
37+
echo "Installing the ${wheel} wheel"
38+
39+
# Search for the python-specific wheel version and install it if exists
40+
wheel_path=$(find ${{ inputs.wheels-dir-path }} -name "$wheel-*cp$py_version*.whl")
41+
echo "Wheel path: ${wheel_path}"
42+
if [ -n "${wheel_path}" ]; then
43+
python3 -m pip install $wheel_path
44+
else
45+
# If the python-specific version does not exist, install by name only
46+
python3 -m pip install ${{ inputs.wheels-dir-path }}/$wheel-*.whl
47+
fi
48+
done

.github/workflows/job_build_windows.yml

+55-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ on:
2121
description: 'A string of options passed to CMake'
2222
type: string
2323
required: true
24+
build-additional-python-wheels:
25+
description: 'Whether to build additional, i.e., non-system Python wheels. Should have Python 3.9-3.12 installed'
26+
type: boolean
27+
required: false
28+
default: false
2429

2530
permissions: read-all
2631

@@ -157,8 +162,7 @@ jobs:
157162
run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV
158163

159164
- name: CMake configure
160-
run: |
161-
cmake -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }} ${{ inputs.cmake-options }}
165+
run: cmake -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }} ${{ inputs.cmake-options }}
162166

163167
- name: Clean ccache stats
164168
run: '& ccache --zero-stats'
@@ -176,6 +180,54 @@ jobs:
176180
cmake --install . --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${{ env.INSTALL_TEST_DIR }} --component tests
177181
working-directory: ${{ env.BUILD_DIR }}
178182

183+
# Setup additional Python versions for wheels building
184+
- name: Setup Python 3.9
185+
if: ${{ inputs.build-additional-python-wheels }}
186+
uses: ./openvino/.github/actions/setup_python
187+
with:
188+
version: '3.9'
189+
pip-cache-path: ${{ env.PIP_CACHE_PATH }}
190+
should-setup-pip-paths: 'true'
191+
self-hosted-runner: 'true'
192+
193+
# Setup additional Python versions for wheels building
194+
- name: Setup Python 3.10
195+
if: ${{ inputs.build-additional-python-wheels }}
196+
uses: ./openvino/.github/actions/setup_python
197+
with:
198+
version: '3.10'
199+
pip-cache-path: ${{ env.PIP_CACHE_PATH }}
200+
should-setup-pip-paths: 'true'
201+
self-hosted-runner: 'true'
202+
203+
# Setup additional Python versions for wheels building
204+
- name: Setup Python 3.12
205+
if: ${{ inputs.build-additional-python-wheels }}
206+
uses: ./openvino/.github/actions/setup_python
207+
with:
208+
version: '3.12'
209+
pip-cache-path: ${{ env.PIP_CACHE_PATH }}
210+
should-setup-pip-paths: 'true'
211+
self-hosted-runner: 'true'
212+
213+
- name: Build additional Python wheels
214+
if: ${{ inputs.build-additional-python-wheels }}
215+
run: |
216+
$pyVersions = '3.9', '3.10', '3.12'
217+
foreach ($pyVersion in $pyVersions) {
218+
$pyBuildDir = "${{ github.workspace }}/py$pyVersion"
219+
New-Item -ItemType Directory -Path "$pyBuildDir" -Force
220+
221+
$pythonCommand = "py -$pyVersion -c `"import sys; print(f'{sys.executable}')`""
222+
$pythonExecutablePath = & cmd /c $pythonCommand
223+
224+
& $pythonExecutablePath -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
225+
226+
cmake -DPython3_EXECUTABLE="$pythonExecutablePath" -DOpenVINODeveloperPackage_DIR=${{ env.BUILD_DIR }} -S ${{ env.OPENVINO_REPO }}/src/bindings/python -B "$pyBuildDir"
227+
cmake --build "$pyBuildDir" --parallel --config ${{ env.CMAKE_BUILD_TYPE }}
228+
cmake --install "$pyBuildDir" --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${{ env.INSTALL_WHEELS_DIR }} --component python_wheels
229+
}
230+
179231
- name: Pack Artifacts
180232
run: |
181233
$file = Get-ChildItem -Path "${{ env.INSTALL_DIR }}"
@@ -220,7 +272,7 @@ jobs:
220272
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
221273
with:
222274
name: openvino_wheels
223-
path: ${{ env.BUILD_DIR }}/wheels/*.whl
275+
path: ${{ env.INSTALL_WHEELS_DIR }}/wheels/*.whl
224276
if-no-files-found: 'error'
225277

226278
- name: Upload openvino tests package

.github/workflows/job_pytorch_layer_tests.yml

+8-15
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
echo "OPENVINO_REPO=$GITHUB_WORKSPACE/openvino" >> "$GITHUB_ENV"
6666
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
6767
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV"
68+
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV"
6869
echo "LAYER_TESTS_INSTALL_DIR=$GITHUB_WORKSPACE/install/tests/layer_tests" >> "$GITHUB_ENV"
6970
7071
- name: Install OpenVINO dependencies (mac)
@@ -83,11 +84,12 @@ jobs:
8384
Expand-Archive openvino_tests.zip -DestinationPath ${{ env.INSTALL_DIR }}
8485
working-directory: ${{ env.INSTALL_DIR }}
8586

86-
- name: Fetch setup_python action
87+
- name: Fetch setup_python and install wheels actions
8788
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8889
with:
8990
sparse-checkout: |
9091
.github/actions/setup_python/action.yml
92+
.github/actions/install_ov_wheels/action.yml
9193
sparse-checkout-cone-mode: false
9294
path: 'openvino'
9395

@@ -99,20 +101,11 @@ jobs:
99101
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
100102
self-hosted-runner: ${{ runner.os != 'macOS' }}
101103

102-
- name: Install OpenVINO Python wheels (Linux and macOS)
103-
if: runner.os != 'Windows'
104-
run: |
105-
# Install the core OV wheel
106-
python3 -m pip install ./openvino-*.whl
107-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
108-
109-
- name: Install OpenVINO Python wheels (Windows)
110-
if: runner.os == 'Windows'
111-
run: |
112-
# Find and install the core OV wheel
113-
$ovCoreWheelPath=Get-ChildItem -Path . -Filter openvino-*.whl | % { $_.FullName }
114-
python3 -m pip install "$ovCoreWheelPath"
115-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
104+
- name: Install OpenVINO Python wheels
105+
uses: ./openvino/.github/actions/install_ov_wheels
106+
with:
107+
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }}
108+
wheels-to-install: 'openvino'
116109

117110
- name: Install Pytorch Layer tests dependencies
118111
run: |

.github/workflows/job_tensorflow_layer_tests.yml

+8-22
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
6767
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV"
6868
echo "LAYER_TESTS_INSTALL_DIR=$GITHUB_WORKSPACE/install/tests/layer_tests" >> "$GITHUB_ENV"
69+
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV"
6970
7071
- name: Install OpenVINO dependencies (mac)
7172
if: runner.os == 'macOS'
@@ -83,11 +84,12 @@ jobs:
8384
Expand-Archive openvino_tests.zip -DestinationPath ${{ env.INSTALL_DIR }}
8485
working-directory: ${{ env.INSTALL_DIR }}
8586

86-
- name: Fetch setup_python action
87+
- name: Fetch setup_python and install wheels actions
8788
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8889
with:
8990
sparse-checkout: |
9091
.github/actions/setup_python/action.yml
92+
.github/actions/install_ov_wheels/action.yml
9193
sparse-checkout-cone-mode: false
9294
path: 'openvino'
9395

@@ -99,27 +101,11 @@ jobs:
99101
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
100102
self-hosted-runner: ${{ runner.os != 'macOS' }}
101103

102-
- name: Install OpenVINO Python wheels (Linux and macOS)
103-
if: runner.os != 'Windows'
104-
run: |
105-
# Install the core OV wheel
106-
python3 -m pip install ./openvino-*.whl
107-
108-
# Install the core OV Tokenizers wheel
109-
python3 -m pip install ./openvino_tokenizers-*.whl
110-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
111-
112-
- name: Install OpenVINO Python wheels (Windows)
113-
if: runner.os == 'Windows'
114-
run: |
115-
# Find and install the core OV wheel
116-
$ovCoreWheelPath=Get-ChildItem -Path . -Filter openvino-*.whl | % { $_.FullName }
117-
python3 -m pip install "$ovCoreWheelPath"
118-
119-
# Find and install the core OV Tokenizers wheel
120-
$ovCoreWheelPath=Get-ChildItem -Path . -Filter openvino_tokenizers-*.whl | % { $_.FullName }
121-
python3 -m pip install "$ovCoreWheelPath"
122-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
104+
- name: Install OpenVINO Python wheels
105+
uses: ./openvino/.github/actions/install_ov_wheels
106+
with:
107+
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }}
108+
wheels-to-install: 'openvino openvino_tokenizers'
123109

124110
- name: Install Python Layer tests dependencies
125111
run: |

.github/workflows/job_tokenizers.yml

+8-17
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ jobs:
5454
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
5555
echo "OPENVINO_TOKENIZERS_REPO=$GITHUB_WORKSPACE/openvino_tokenizers" >> "$GITHUB_ENV"
5656
echo "EXTENSION_BUILD_DIR=$GITHUB_WORKSPACE/build" >> "$GITHUB_ENV"
57+
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV"
5758
58-
- name: checkout action
59+
- name: checkout actions
5960
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6061
with:
6162
sparse-checkout: |
6263
.github/actions/setup_python
6364
.github/actions/cache
65+
.github/actions/install_ov_wheels/action.yml
6466
install_build_dependencies.sh
6567
6668
- name: Install OpenVINO dependencies (mac)
@@ -93,22 +95,11 @@ jobs:
9395
# Dependencies
9496
#
9597

96-
- name: Install OpenVINO Python wheel (Linux and macOS)
97-
if: runner.os != 'Windows'
98-
run: |
99-
# Find and install wheel
100-
wheel_name=$(find . -name 'openvino-*.whl')
101-
python3 -m pip install $wheel_name
102-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
103-
104-
105-
- name: Install OpenVINO Python wheel (Windows)
106-
if: runner.os == 'Windows'
107-
run: |
108-
# Find and install wheel
109-
$ovCoreWheelPath=Get-ChildItem -Path . -Filter openvino-*.whl | % { $_.FullName }
110-
python3 -m pip install "$ovCoreWheelPath"
111-
working-directory: ${{ env.INSTALL_WHEELS_DIR }}
98+
- name: Install OpenVINO Python wheels
99+
uses: ./.github/actions/install_ov_wheels
100+
with:
101+
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }}
102+
wheels-to-install: 'openvino'
112103

113104
#
114105
# Build

0 commit comments

Comments
 (0)