forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (162 loc) · 7.63 KB
/
job_python_unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Python unit 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}'
affected-components:
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
jobs:
Python_Unit_Tests:
name: Python unit tests
timeout-minutes: 70
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_WHEELS_DIR: ${{ github.workspace }}/install/wheels
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests
steps:
- name: Download OpenVINO artifacts (tarballs)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: openvino_[tests]*
path: ${{ env.INSTALL_DIR }}
merge-multiple: true
- name: Download OpenVINO artifacts (wheels)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: openvino_[wheels]*
path: ${{ env.INSTALL_WHEELS_DIR }}
merge-multiple: true
# 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"
echo "LAYER_TESTS_INSTALL_DIR=$GITHUB_WORKSPACE/install/tests/layer_tests" >> "$GITHUB_ENV"
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV"
- name: Install OpenVINO dependencies (mac)
if: runner.os == 'macOS'
run: brew install pigz
- name: Extract OpenVINO packages
run: pigz -dc openvino_tests.tar.gz | tar -xf - -C ${INSTALL_DIR}
working-directory: ${{ env.INSTALL_DIR }}
- name: Fetch setup_python and install wheels actions
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
timeout-minutes: 15
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' }}
- name: Install OpenVINO Python wheels
uses: ./action_root/.github/actions/install_ov_wheels
with:
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }}
wheels-to-install: 'openvino'
- name: Install Python API tests dependencies
run: |
# To enable pytest parallel features
python3 -m pip install pytest-xdist[psutil]
python3 -m pip install -r ${INSTALL_TEST_DIR}/bindings/python/requirements_test.txt
- name: Install Python Layer tests dependencies and for OVC unit tests
run: |
# For torchvision to OpenVINO preprocessing converter
python3 -m pip install -r ${INSTALL_TEST_DIR}/python/preprocess/torchvision/requirements.txt
# layer test requirements
python3 -m pip install -r ${LAYER_TESTS_INSTALL_DIR}/requirements.txt
- name: Install ONNX tests dependencies
run: |
# ONNX tests requirements
python3 -m pip install -r ${INSTALL_TEST_DIR}/requirements_onnx
#
# Tests
#
- name: Python ONNX operators tests
if: (fromJSON(inputs.affected-components).Python_API.test ||
fromJSON(inputs.affected-components).ONNX_FE.test) &&
runner.arch != 'ARM64' # Ticket: 123325
run: |
# Skip test_onnx/test_zoo_models and test_onnx/test_backend due to long execution time - ONNX Model Zoo tests are run separately
python3 -m pytest -sv ${INSTALL_TEST_DIR}/onnx -k 'not cuda' \
--junitxml=${INSTALL_TEST_DIR}/TEST-onnx_frontend.xml \
--ignore=${INSTALL_TEST_DIR}/onnx/test_python/test_zoo_models.py
- name: OVC unit tests
if: fromJSON(inputs.affected-components).MO.test
run: python3 -m pytest -s ${INSTALL_TEST_DIR}/ovc/unit_tests --junitxml=${INSTALL_TEST_DIR}/TEST-OpenVinoConversion.xml
- name: OVC Python API Tests
if: fromJSON(inputs.affected-components).MO.test
run: |
# Import 'test_utils' installed in '<package_test>/tests/python/openvino'
export PYTHONPATH=${INSTALL_TEST_DIR}/python
export LD_LIBRARY_PATH=${PIP_INSTALL_PATH}/openvino/libs:$LD_LIBRARY_PATH
if [[ "${{ runner.os }}" == "Linux" ]] && [[ "${{ runner.arch }}" == "ARM64" ]]; then
# Find gomp lib
GOMP_LIB=$(find "${PIP_INSTALL_PATH}/torch/lib/../../torch.libs/" -name '*libgomp-*so*')
export LD_PRELOAD=${GOMP_LIB}
fi
python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/ovc_python_api_tests -n logical --junitxml=${INSTALL_TEST_DIR}/TEST-test_ovc_convert.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP16
- name: Python Frontend tests
if: fromJSON(inputs.affected-components).PyTorch_FE.test ||
fromJSON(inputs.affected-components).PDPD_FE.test
run: |
# to allow 'libtest_builtin_extensions.so' to find 'libopenvino_onnx_frontend.so'
export LD_LIBRARY_PATH=${PIP_INSTALL_PATH}/openvino/libs:$LD_LIBRARY_PATH
python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/py_frontend_tests --junitxml=${INSTALL_TEST_DIR}/TEST-test_py_fontend.xml
- name: JAX Layer Tests - JAX FE
if: ${{ fromJSON(inputs.affected-components).JAX_FE.test && runner.arch != 'ARM64' && runner.os != 'macOS' }}
run: python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/jax_tests/ -m precommit_jax_fe --junitxml=${INSTALL_TEST_DIR}/TEST-jax_fe.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP16
JAX_TRACE_MODE: JAXPR
- name: TensorFlow Lite Layer Tests - TFL FE
if: fromJSON(inputs.affected-components).TFL_FE.test
run: python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/tensorflow_lite_tests/ -n logical --junitxml=${INSTALL_TEST_DIR}/TEST-tfl_fe.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP16
- name: Upload Test Results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ !cancelled() }}
with:
name: test-results-python
path: |
${{ env.INSTALL_TEST_DIR }}/TEST*.html
${{ env.INSTALL_TEST_DIR }}/TEST*.xml
if-no-files-found: 'warn'