11name : Test examples
2- run-name : " Test examples${{ inputs.pr_num != '' && format(' PR#{0}', inputs.pr_num) || '' }}${{ inputs.pytest_args != '' && format(' [{0}]', inputs.pytest_args) || '' }}"
32permissions : read-all
43
54on :
6- workflow_call :
7- inputs :
8- pr_num :
9- description : ' The pull request number'
10- type : string
11- default : ' '
12- pytest_args :
13- description : ' Pytest arguments'
14- type : string
15- default : ' '
16- skip_windows :
17- description : ' Skip tests on Windows'
18- type : boolean
19- default : false
20- skip_gpu :
21- description : ' Skip tests on GPU'
22- type : boolean
23- default : false
24- workflow_dispatch :
25- inputs :
26- pr_num :
27- description : ' The pull request number'
28- default : ' '
29- pytest_args :
30- description : ' Pytest arguments'
31- default : ' '
32- skip_windows :
33- description : ' Skip tests on Windows'
34- type : boolean
35- default : false
36- skip_gpu :
37- description : ' Skip tests on GPU'
38- type : boolean
39- default : false
5+ pull_request :
406
417defaults :
428 run :
439 shell : bash
4410
4511env :
46- PYTEST_ARGS : ${{ inputs.pytest_args || '' }}
4712 TQDM_DISABLE : 1
4813 RESULT_XML : " pytest-results.xml"
4914 PYTHON_VERSION : " 3.12"
5924 group : [1, 2, 3, 4, 5, 6]
6025 steps :
6126 - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
62- with :
63- ref : ${{ inputs.pr_num != '' && format('refs/pull/{0}/head', inputs.pr_num) || github.ref }}
64- - uses : actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
65- with :
66- python-version : ${{ env.PYTHON_VERSION }}
67- - name : cpuinfo
68- run : cat /proc/cpuinfo
69- - name : Install test requirements
70- run : |
71- pip install -r tests/cross_fw/examples/requirements.txt
72- - name : Print installed modules
73- run : pip list
74- - name : Run examples test scope
75- run : |
76- set +e
77- python -m pytest -s -ra tests/cross_fw/examples \
78- -m 'not cuda' \
79- --junit-xml=${{ env.RESULT_XML }} \
80- --durations-path=tests/cross_fw/examples/test_durations.json \
81- --splitting-algorithm=least_duration \
82- --splits 6 \
83- --group ${{ matrix.group }} \
84- ${{ env.PYTEST_ARGS }}
85- ret=$?
86- [ $ret -eq 5 ] && [ -n "${{ inputs.pytest_args || '' }}" ] && exit 0 || exit $ret
87- - name : Upload test results
88- if : ${{ !cancelled() }}
89- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
90- with :
91- name : examples-cpu-pytest-results-${{ matrix.group }}
92- path : ${{ env.RESULT_XML }}
93- retention-days : 7
94-
95- examples-cuda :
96- name : Test examples CUDA [${{ matrix.group }}/1]
97- runs-on : aks-linux-6-cores-55gb-gpu-a10
98- timeout-minutes : 40
99- if : ${{ !inputs.skip_gpu }}
100- strategy :
101- fail-fast : false
102- matrix :
103- group : [1]
104- env :
105- DEBIAN_FRONTEND : noninteractive
106- steps :
107- - name : Install dependencies
108- run : |
109- sudo apt-get update
110- sudo apt-get --assume-yes install build-essential ninja-build libgl1-mesa-dev libglib2.0-0 wget make
111- - name : Download CUDA
112- run : |
113- wget -q https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_560.35.05_linux.run
114- sudo sh cuda_12.6.3_560.35.05_linux.run --toolkit --silent
115- - name : Runner info
116- continue-on-error : true
117- run : |
118- nvidia-smi
119- cat /proc/cpuinfo
120- - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
121- with :
122- ref : ${{ inputs.pr_num != '' && format('refs/pull/{0}/head', inputs.pr_num) || github.ref }}
12327 - uses : actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
12428 with :
12529 python-version : ${{ env.PYTHON_VERSION }}
@@ -133,98 +37,4 @@ jobs:
13337 - name : Run examples test scope
13438 run : |
13539 set +e
136- python -m pytest -s -ra tests/cross_fw/examples \
137- -m cuda \
138- --junit-xml=${{ env.RESULT_XML }} \
139- --durations-path=tests/cross_fw/examples/test_durations.json \
140- --splitting-algorithm=least_duration \
141- --splits 1 \
142- --group ${{ matrix.group }} \
143- ${{ env.PYTEST_ARGS }}
144- ret=$?
145- [ $ret -eq 5 ] && [ -n "${{ inputs.pytest_args || '' }}" ] && exit 0 || exit $ret
146- - name : Upload test results
147- if : ${{ !cancelled() }}
148- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
149- with :
150- name : examples-cuda-pytest-results-${{ matrix.group }}
151- path : ${{ env.RESULT_XML }}
152- retention-days : 7
153-
154- examples-win-cpu :
155- name : Test examples CPU Windows [${{ matrix.group }}/6]
156- runs-on : windows-2025-16-core
157- timeout-minutes : 80
158- if : ${{ !inputs.skip_windows }}
159- strategy :
160- fail-fast : false
161- matrix :
162- group : [1, 2, 3, 4, 5, 6]
163- env :
164- PYTHONIOENCODING : utf-8
165- NNCF_EXTENSION_LOAD_TIMEOUT : 180
166- steps :
167- - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
168- with :
169- ref : ${{ inputs.pr_num != '' && format('refs/pull/{0}/head', inputs.pr_num) || github.ref }}
170- - uses : actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
171- with :
172- python-version : ${{ env.PYTHON_VERSION }}
173- - uses : ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
174- - name : Install NNCF and test requirements
175- run : |
176- pip install -r tests/cross_fw/examples/requirements.txt
177- - name : Print installed modules
178- run : pip list
179- - name : Run examples test scope
180- run : |
181- set +e
182-
183- sys_lib="$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")"
184- prefix_lib="$(python -c "import sys; print(sys.prefix + '/libs')")"
185- include_dir="$(python -c "import sysconfig; print(sysconfig.get_path('include'))")"
186-
187- export LIB="${LIB};${sys_lib};${prefix_lib}"
188- export INCLUDE="${INCLUDE};${include_dir}"
189-
190- python -m pytest -s -ra tests/cross_fw/examples \
191- -m 'not cuda' \
192- --junit-xml=${{ env.RESULT_XML }} \
193- --durations-path=tests/cross_fw/examples/test_durations.json \
194- --splitting-algorithm=least_duration \
195- --splits 6 \
196- --group ${{ matrix.group }} \
197- ${{ env.PYTEST_ARGS }}
198- ret=$?
199- [ $ret -eq 5 ] && [ -n "${{ inputs.pytest_args || '' }}" ] && exit 0 || exit $ret
200- - name : Upload test results
201- if : ${{ !cancelled() }}
202- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
203- with :
204- name : examples-win-cpu-pytest-results-${{ matrix.group }}
205- path : ${{ env.RESULT_XML }}
206- retention-days : 7
207-
208- examples-cpu-summary :
209- name : Summary Examples CPU
210- if : ${{ !cancelled() }}
211- needs : examples-cpu
212- uses : ./.github/workflows/call_summary.yml
213- with :
214- artifact_pattern : examples-cpu-pytest-results-*
215-
216- examples-cuda-summary :
217- name : Summary Examples CUDA
218- if : ${{ !cancelled() && !inputs.skip_gpu }}
219- needs : examples-cuda
220- uses : ./.github/workflows/call_summary.yml
221- with :
222- artifact_pattern : examples-cuda-pytest-results-*
223-
224- examples-win-cpu-summary :
225- name : Summary Examples Windows CPU
226- if : ${{ !cancelled() && !inputs.skip_windows }}
227- needs : examples-win-cpu
228- uses : ./.github/workflows/call_summary.yml
229- with :
230- artifact_pattern : examples-win-cpu-pytest-results-*
40+ python -m pytest -s -ra tests/cross_fw/examples
0 commit comments