Skip to content

Commit 763d2e8

Browse files
Merge branch 'develop' into ad/gha_pt_wc
2 parents b9cdfe8 + a25d85e commit 763d2e8

File tree

362 files changed

+55757
-36196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+55757
-36196
lines changed

.github/scripts/pytest_md_summary.py

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (c) 2024 Intel Corporation
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS,
8+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
# See the License for the specific language governing permissions and
10+
# limitations under the License.
11+
12+
import sys
13+
14+
from defusedxml import ElementTree as ET
15+
16+
17+
def parse_xml_report(xml_file) -> None:
18+
"""
19+
Parse the XML report generated by pytest.
20+
21+
:param xml_file: Path to the XML report file
22+
:return: None
23+
"""
24+
try:
25+
tree = ET.parse(xml_file)
26+
except FileNotFoundError:
27+
sys.exit(1)
28+
29+
root = tree.getroot()
30+
31+
# Build the summary table in Markdown format
32+
table_lines = []
33+
table_lines.append("| Test Name | Status | Time | Message |")
34+
table_lines.append("|:----------|:------:|-----:|:--------|")
35+
36+
# Iterate over test cases
37+
for testcase in root.findall(".//testcase"):
38+
test_name = testcase.get("name")
39+
time_duration = float(testcase.get("time", "0"))
40+
message = ""
41+
if testcase.find("failure") is not None:
42+
status = "$${\color{red}Failed}$$"
43+
message = testcase.find("failure").get("message", "")
44+
elif testcase.find("error") is not None:
45+
status = "$${\color{red}Error}$$"
46+
elif testcase.find("skipped") is not None:
47+
status = "$${\color{orange}Skipped}$$"
48+
message = testcase.find("skipped").get("message", "")
49+
else:
50+
status = "$${\color{green}Ok}$$"
51+
52+
# Append each row to the table
53+
if message:
54+
message = message.splitlines()[0][:60]
55+
table_lines.append(f"| {test_name} | {status} | {time_duration:.0f} | {message} |")
56+
57+
if len(table_lines) > 2:
58+
# Print the summary table only if there are test cases
59+
print("\n".join(table_lines))
60+
61+
62+
if __name__ == "__main__":
63+
"""
64+
This script generates a summary table in Markdown format from an XML report generated by pytest.
65+
66+
Usage in GitHub workflow:
67+
- name: Test Summary
68+
if: ${{ !cancelled() }}
69+
run: |
70+
python .github/scripts/generate_examples_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY
71+
"""
72+
try:
73+
parse_xml_report(sys.argv[1])
74+
except Exception as e:
75+
print(f"Error: {e}")

.github/workflows/api_set_label.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
issue_number: ${{ steps.status.outputs.pr_number }},
5858
owner: context.repo.owner,
5959
repo: context.repo.repo,
60-
labels: "API"
60+
name: "API"
6161
})

.github/workflows/call_precommit.yml

+234
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: call-precommit
2+
permissions: read-all
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
python_version:
8+
description: 'Python version'
9+
type: string
10+
required: true
11+
gpu_enabled:
12+
description: 'Enable gpu tests'
13+
type: boolean
14+
default: false
15+
required: true
16+
17+
jobs:
18+
common:
19+
timeout-minutes: 40
20+
runs-on: ubuntu-20.04
21+
defaults:
22+
run:
23+
shell: bash
24+
steps:
25+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
26+
with:
27+
lfs: true
28+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
29+
with:
30+
python-version: ${{ inputs.python_version }}
31+
cache: pip
32+
- name: Install NNCF and test requirements
33+
run: make install-common-test
34+
- name: Print installed modules
35+
run: pip list
36+
- name: Run common precommit test scope
37+
run: make test-common
38+
env:
39+
NUM_WORKERS: 2
40+
41+
onnx:
42+
timeout-minutes: 40
43+
runs-on: ubuntu-20.04-8-cores
44+
defaults:
45+
run:
46+
shell: bash
47+
steps:
48+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
49+
with:
50+
lfs: true
51+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
52+
with:
53+
python-version: ${{ inputs.python_version }}
54+
- name: Install NNCF and test requirements
55+
run: make install-onnx-test
56+
- name: Print installed modules
57+
run: pip list
58+
- name: Run ONNX precommit test scope
59+
run: make test-onnx
60+
env:
61+
NUM_WORKERS: 4
62+
63+
openvino:
64+
timeout-minutes: 40
65+
runs-on: ubuntu-20.04-8-cores
66+
defaults:
67+
run:
68+
shell: bash
69+
steps:
70+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
71+
with:
72+
lfs: true
73+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
74+
with:
75+
python-version: ${{ inputs.python_version }}
76+
cache: pip
77+
- name: Install NNCF and test requirements
78+
run: make install-openvino-test
79+
- name: Print installed modules
80+
run: pip list
81+
- name: Run OV precommit test scope
82+
run: make test-openvino
83+
env:
84+
NUM_WORKERS: 4
85+
86+
pytorch-cpu:
87+
timeout-minutes: 40
88+
runs-on: ubuntu-20.04-8-cores
89+
defaults:
90+
run:
91+
shell: bash
92+
env:
93+
DEBIAN_FRONTEND: noninteractive
94+
steps:
95+
- name: Install dependencies
96+
run : |
97+
sudo apt-get update
98+
sudo apt-get --assume-yes install gcc g++ build-essential ninja-build libgl1-mesa-dev libglib2.0-0
99+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
100+
with:
101+
lfs: true
102+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
103+
with:
104+
python-version: ${{ inputs.python_version }}
105+
cache: pip
106+
- name: Runner info
107+
continue-on-error: true
108+
run: |
109+
cat /etc/*release
110+
cat /proc/cpuinfo
111+
- name: Install NNCF and test requirements
112+
run: make install-torch-test
113+
- name: Print installed modules
114+
run: pip list
115+
- name: Run PyTorch precommit test scope
116+
run: |
117+
make test-torch-cpu
118+
env:
119+
NUM_WORKERS: 4
120+
121+
pytorch-cuda:
122+
timeout-minutes: 40
123+
runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4
124+
if: ${{ inputs.gpu_enabled == true }}
125+
defaults:
126+
run:
127+
shell: bash
128+
env:
129+
DEBIAN_FRONTEND: noninteractive
130+
steps:
131+
- name: Install dependencies
132+
run : |
133+
sudo apt-get update
134+
sudo apt-get --assume-yes install build-essential ninja-build libgl1-mesa-dev libglib2.0-0 wget make
135+
- name: Download CUDA
136+
run: |
137+
wget -q https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run
138+
sudo sh cuda_12.4.0_550.54.14_linux.run --toolkit --silent
139+
- name: Runner info
140+
continue-on-error: true
141+
run: |
142+
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
143+
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
144+
nvidia-smi
145+
cat /proc/cpuinfo
146+
nvcc --version
147+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
148+
with:
149+
lfs: true
150+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
151+
with:
152+
python-version: ${{ inputs.python_version }}
153+
cache: pip
154+
- name: Install NNCF and test requirements
155+
run: make install-torch-test
156+
- name: Print installed modules
157+
run: pip list
158+
- name: Check CUDA
159+
run: |
160+
python -c "import torch; print(torch.cuda.is_available())"
161+
- name: Run PyTorch precommit test scope
162+
run: |
163+
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
164+
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
165+
make test-torch-cuda
166+
167+
tensorflow:
168+
timeout-minutes: 40
169+
runs-on: ubuntu-20.04-8-cores
170+
if: ${{ inputs.python_version != '3.12' }}
171+
defaults:
172+
run:
173+
shell: bash
174+
env:
175+
DEBIAN_FRONTEND: noninteractive
176+
steps:
177+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
178+
with:
179+
lfs: true
180+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
181+
with:
182+
python-version: ${{ inputs.python_version }}
183+
cache: pip
184+
- name: Install NNCF and test requirements
185+
run: make install-tensorflow-test
186+
- name: Print installed modules
187+
run: pip list
188+
- name: Run TensorFlow precommit test scope
189+
run: make test-tensorflow
190+
env:
191+
NUM_WORKERS: 6
192+
193+
tools:
194+
timeout-minutes: 40
195+
runs-on: ubuntu-20.04
196+
defaults:
197+
run:
198+
shell: bash
199+
steps:
200+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
201+
with:
202+
lfs: true
203+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
204+
with:
205+
python-version: ${{ inputs.python_version }}
206+
cache: pip
207+
- name: Install NNCF and test requirements
208+
run: pip install -r tests/tools/requirements.txt
209+
- name: Print installed modules
210+
run: pip list
211+
- name: Run tools precommit test scope
212+
run: pytest -ra tests/tools
213+
214+
pytorch2-cpu:
215+
timeout-minutes: 40
216+
runs-on: ubuntu-20.04
217+
defaults:
218+
run:
219+
shell: bash
220+
steps:
221+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
222+
with:
223+
lfs: true
224+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
225+
with:
226+
python-version: ${{ inputs.python_version }}
227+
cache: pip
228+
- name: Install NNCF and test requirements
229+
run: |
230+
pip install -r tests/torch2/requirements.txt -e .
231+
- name: Print installed modules
232+
run: pip list
233+
- name: Run torch2 precommit test scope
234+
run: pytest -ra tests/torch2 -m "not cuda"

0 commit comments

Comments
 (0)