From 3f0bd0f5cd7569423d21a32b8bf20c5567902a05 Mon Sep 17 00:00:00 2001 From: Andrei Kashchikhin Date: Thu, 12 Sep 2024 18:23:08 +0100 Subject: [PATCH] [CI] [GHA] Enable testing of Python 3.12 on Ubuntu 24 (#26466) ### Tickets: - *151255* --------- Co-authored-by: Anastasia Kuporosova --- .github/workflows/job_python_unit_tests.yml | 13 ++++++++----- .github/workflows/linux_arm64.yml | 2 +- .github/workflows/mac.yml | 1 + .github/workflows/mac_arm64.yml | 1 + .github/workflows/ubuntu_22.yml | 1 + .github/workflows/ubuntu_24.yml | 13 +++++++++++-- .../ovc_python_api_tests/test_ovc_cli_tool.py | 17 ++++++++++++++++- .../layer_tests/ovc_python_api_tests/test_tf.py | 9 +++++++++ tools/mo/unit_tests/mo/ops/elementwise_test.py | 6 +++--- 9 files changed, 51 insertions(+), 12 deletions(-) diff --git a/.github/workflows/job_python_unit_tests.yml b/.github/workflows/job_python_unit_tests.yml index f793860958f31a..81767c7805f823 100644 --- a/.github/workflows/job_python_unit_tests.yml +++ b/.github/workflows/job_python_unit_tests.yml @@ -16,12 +16,15 @@ on: description: 'Components that are affected by changes in the commit defined by the Smart CI Action' type: string required: true + 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 - PYTHON_VERSION: '3.11' jobs: Python_Unit_Tests: @@ -77,10 +80,10 @@ jobs: sparse-checkout-cone-mode: false path: 'action_root' - - name: Setup Python ${{ env.PYTHON_VERSION }} + - name: Setup Python ${{ inputs.python-version }} uses: ./action_root/.github/actions/setup_python with: - version: ${{ env.PYTHON_VERSION }} + 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' }} @@ -231,7 +234,7 @@ jobs: PYTORCH_TRACING_MODE: TORCHFX - name: ONNX Layer Tests - if: fromJSON(inputs.affected-components).ONNX_FE.test + if: ${{ fromJSON(inputs.affected-components).ONNX_FE.test }} run: | # requires 'unit_tests' from 'tools/mo' export PYTHONPATH=${INSTALL_TEST_DIR}/mo:$PYTHONPATH @@ -296,7 +299,7 @@ jobs: python3 ${OPENVINO_REPO}/docs/articles_en/assets/snippets/main.py - name: Python API Tests -- numpy>=2.0.0 - if: ${{ fromJSON(inputs.affected-components).Python_API.test }} + if: ${{ fromJSON(inputs.affected-components).Python_API.test && inputs.python-version != '3.12' }} # Ticket: 152242 run: | python3 -m pip uninstall -y numpy python3 -m pip install "numpy>=2.0.0,<2.1.0" diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml index a447c41897792d..41d0837e0e4a99 100644 --- a/.github/workflows/linux_arm64.yml +++ b/.github/workflows/linux_arm64.yml @@ -17,7 +17,6 @@ permissions: read-all env: PIP_CACHE_PATH: /mount/caches/pip/linux - PYTHON_VERSION: '3.11' jobs: Smart_CI: @@ -388,6 +387,7 @@ jobs: runner: 'aks-linux-16-cores-arm' container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_arm64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' TensorFlow_Layer_Tests: name: TensorFlow Layer Tests diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index ca1d804a0c4e1f..715380811d6870 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -267,6 +267,7 @@ jobs: with: runner: 'macos-13' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' TensorFlow_Layer_Tests: name: TensorFlow Layer Tests diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml index efcbc56fb2c9b5..2615fe16316ea7 100644 --- a/.github/workflows/mac_arm64.yml +++ b/.github/workflows/mac_arm64.yml @@ -266,6 +266,7 @@ jobs: with: runner: 'macos-13-xlarge' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' TensorFlow_Layer_Tests: name: TensorFlow Layer Tests diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml index 187a42a3bf8f02..54410acdf71fac 100644 --- a/.github/workflows/ubuntu_22.yml +++ b/.github/workflows/ubuntu_22.yml @@ -296,6 +296,7 @@ jobs: runner: 'aks-linux-4-cores-16gb' container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' TensorFlow_Layer_Tests: name: TensorFlow Layer Tests diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml index ce55afe426ba5a..a0e1b314391b24 100644 --- a/.github/workflows/ubuntu_24.yml +++ b/.github/workflows/ubuntu_24.yml @@ -17,7 +17,6 @@ permissions: read-all env: PIP_CACHE_PATH: /mount/caches/pip/linux - PYTHON_VERSION: '3.11' jobs: Smart_CI: @@ -115,9 +114,19 @@ jobs: container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_24_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + Python_Unit_Tests: + name: Python unit tests + needs: [ Docker, Build, Smart_CI ] + uses: ./.github/workflows/job_python_unit_tests.yml + with: + runner: 'aks-linux-4-cores-16gb' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_24_04_x64 }}", "volumes": ["/mount:/mount"]}' + affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.12' + Overall_Status: name: ci/gha_overall_status_ubuntu_24 - needs: [Smart_CI, Build, Debian_Packages, Samples] + needs: [Smart_CI, Build, Debian_Packages, Samples, Python_Unit_Tests] if: ${{ always() }} runs-on: ubuntu-latest steps: diff --git a/tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py b/tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py index 422c4bdb743745..8ca07fd2334b60 100644 --- a/tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py +++ b/tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py @@ -141,6 +141,10 @@ def test_ovc_tool_output_dir(self): flag, msg = compare_functions(ov_model, create_ref_graph(), False) assert flag, msg + @unittest.skipIf( + (sys.version_info[0], sys.version_info[1]) == (3, 12), + 'Ticket: 152216' + ) def test_ovc_tool_saved_model_dir(self): from openvino.runtime import Core core = Core() @@ -154,6 +158,10 @@ def test_ovc_tool_saved_model_dir(self): flag, msg = compare_functions(ov_model, ref_model, False) assert flag, msg + @unittest.skipIf( + (sys.version_info[0], sys.version_info[1]) == (3, 12), + 'Ticket: 152216' + ) def test_ovc_tool_saved_model_dir_with_sep_at_path_end(self): from openvino.runtime import Core core = Core() @@ -167,6 +175,10 @@ def test_ovc_tool_saved_model_dir_with_sep_at_path_end(self): flag, msg = compare_functions(ov_model, ref_model, False) assert flag, msg + @unittest.skipIf( + (sys.version_info[0], sys.version_info[1]) == (3, 12), + 'Ticket: 152216' + ) def test_ovc_tool_non_existng_output_dir(self): from openvino.runtime import Core core = Core() @@ -180,7 +192,10 @@ def test_ovc_tool_non_existng_output_dir(self): flag, msg = compare_functions(ov_model, ref_model, False) assert flag, msg - + @unittest.skipIf( + (sys.version_info[0], sys.version_info[1]) == (3, 12), + 'Ticket: 152216' + ) def test_ovc_tool_verbose(self): from openvino.runtime import Core core = Core() diff --git a/tests/layer_tests/ovc_python_api_tests/test_tf.py b/tests/layer_tests/ovc_python_api_tests/test_tf.py index 8a89782c4d1261..e1859297fe19b6 100644 --- a/tests/layer_tests/ovc_python_api_tests/test_tf.py +++ b/tests/layer_tests/ovc_python_api_tests/test_tf.py @@ -3,6 +3,7 @@ import numpy as np import openvino.runtime as ov import os +import sys import pytest import tempfile import tensorflow as tf @@ -731,6 +732,10 @@ def test_mo_import_from_memory_tf_fe(self, create_model, ie_device, precision, i @pytest.mark.nightly @pytest.mark.precommit + @pytest.mark.skipif( + condition=(sys.version_info[0], sys.version_info[1]) == (3, 12), + reason='Ticket: 152216' + ) def test_unnamed_saved_model_dir(self, ie_device, precision, ir_version, temp_dir): saved_model_dir, graph_ref = create_tf_saved_model_dir(temp_dir) @@ -1148,6 +1153,10 @@ def test_tf1_from_memory_single_tensor_name(self): @pytest.mark.nightly @pytest.mark.precommit + @pytest.mark.skipif( + condition=(sys.version_info[0], sys.version_info[1]) == (3, 12), + reason='Ticket: 152216' + ) def test_tf2_from_file_single_tensor_name(self): tf.keras.backend.clear_session() tf.compat.v1.reset_default_graph() diff --git a/tools/mo/unit_tests/mo/ops/elementwise_test.py b/tools/mo/unit_tests/mo/ops/elementwise_test.py index fafd47fdd6d7a5..cd47b78c6b824b 100644 --- a/tools/mo/unit_tests/mo/ops/elementwise_test.py +++ b/tools/mo/unit_tests/mo/ops/elementwise_test.py @@ -114,7 +114,7 @@ def test_first_input_const(self): type_infer(graph) const_node = Node(graph, 'const') - self.assertEquals(const_node.out_port(0).get_data_type(), np.float32) + self.assertEqual(const_node.out_port(0).get_data_type(), np.float32) def test_second_input_const(self): edges = [ @@ -126,7 +126,7 @@ def test_second_input_const(self): type_infer(graph) const_node = Node(graph, 'const') - self.assertEquals(const_node.out_port(0).get_data_type(), np.float32) + self.assertEqual(const_node.out_port(0).get_data_type(), np.float32) def test_raises(self): edges = [ @@ -148,4 +148,4 @@ def test_not_raises(self): type_infer(graph) add_node = Node(graph, 'add') - self.assertEquals(add_node.out_port(0).get_data_type(), np.float32) + self.assertEqual(add_node.out_port(0).get_data_type(), np.float32)